From: Timmy Willison Date: Mon, 7 Mar 2016 17:02:20 +0000 (-0500) Subject: Core: fix isPlainObject(Object.create) test in IE X-Git-Tag: 1.12.2~3 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F2989%2Fhead;p=jquery.git Core: fix isPlainObject(Object.create) test in IE --- diff --git a/test/unit/core.js b/test/unit/core.js index 97fc031d9..d6c8e3326 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -328,22 +328,15 @@ QUnit.test( "type for `Symbol`", function( assert ) { } ); QUnit.asyncTest( "isPlainObject", function( assert ) { - assert.expect( 20 ); + assert.expect( 18 ); - var pass, iframe, doc, parentObj, childObj, deep, + var pass, iframe, doc, deep, fn = function() {}; // The use case that we want to match assert.ok( jQuery.isPlainObject( {} ), "{}" ); assert.ok( jQuery.isPlainObject( new window.Object() ), "new Object" ); - parentObj = { foo: "bar" }; - childObj = Object.create( parentObj ); - - assert.ok( !jQuery.isPlainObject( childObj ), "isPlainObject(Object.create({}))" ); - childObj.bar = "foo"; - assert.ok( !jQuery.isPlainObject( childObj ), "isPlainObject(Object.create({}))" ); - // Not objects shouldn't be matched assert.ok( !jQuery.isPlainObject( "" ), "string" ); assert.ok( !jQuery.isPlainObject( 0 ) && !jQuery.isPlainObject( 1 ), "number" ); @@ -417,6 +410,17 @@ QUnit.asyncTest( "isPlainObject", function( assert ) { } } ); +QUnit[ typeof Object.create !== "undefined" ? "test" : "skip" ]( "isPlainObject(Object.create()", function( assert ) { + assert.expect( 2 ); + + var parentObj = { foo: "bar" }, + childObj = Object.create( parentObj ); + + assert.ok( !jQuery.isPlainObject( childObj ), "isPlainObject(Object.create({}))" ); + childObj.bar = "foo"; + assert.ok( !jQuery.isPlainObject( childObj ), "isPlainObject(Object.create({}))" ); +} ); + // QUnit[ typeof Symbol === "function" ? "test" : "skip" ]( "isPlainObject(Symbol)", function( assert ) { assert.expect( 2 );