Skip to content

Commit 88b91af

Browse files
committed
Core: fix isPlainObject(Object.create) test in IE
1 parent b188947 commit 88b91af

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

test/unit/core.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -328,22 +328,15 @@ QUnit.test( "type for `Symbol`", function( assert ) {
328328
} );
329329

330330
QUnit.asyncTest( "isPlainObject", function( assert ) {
331-
assert.expect( 20 );
331+
assert.expect( 18 );
332332

333-
var pass, iframe, doc, parentObj, childObj, deep,
333+
var pass, iframe, doc, deep,
334334
fn = function() {};
335335

336336
// The use case that we want to match
337337
assert.ok( jQuery.isPlainObject( {} ), "{}" );
338338
assert.ok( jQuery.isPlainObject( new window.Object() ), "new Object" );
339339

340-
parentObj = { foo: "bar" };
341-
childObj = Object.create( parentObj );
342-
343-
assert.ok( !jQuery.isPlainObject( childObj ), "isPlainObject(Object.create({}))" );
344-
childObj.bar = "foo";
345-
assert.ok( !jQuery.isPlainObject( childObj ), "isPlainObject(Object.create({}))" );
346-
347340
// Not objects shouldn't be matched
348341
assert.ok( !jQuery.isPlainObject( "" ), "string" );
349342
assert.ok( !jQuery.isPlainObject( 0 ) && !jQuery.isPlainObject( 1 ), "number" );
@@ -417,6 +410,17 @@ QUnit.asyncTest( "isPlainObject", function( assert ) {
417410
}
418411
} );
419412

413+
QUnit[ typeof Object.create !== "undefined" ? "test" : "skip" ]( "isPlainObject(Object.create()", function( assert ) {
414+
assert.expect( 2 );
415+
416+
var parentObj = { foo: "bar" },
417+
childObj = Object.create( parentObj );
418+
419+
assert.ok( !jQuery.isPlainObject( childObj ), "isPlainObject(Object.create({}))" );
420+
childObj.bar = "foo";
421+
assert.ok( !jQuery.isPlainObject( childObj ), "isPlainObject(Object.create({}))" );
422+
} );
423+
420424
//
421425
QUnit[ typeof Symbol === "function" ? "test" : "skip" ]( "isPlainObject(Symbol)", function( assert ) {
422426
assert.expect( 2 );

0 commit comments

Comments
 (0)