diff options
author | Timmy Willison <timmywillisn@gmail.com> | 2016-03-07 12:02:20 -0500 |
---|---|---|
committer | Timmy Willison <timmywillisn@gmail.com> | 2016-03-07 12:02:20 -0500 |
commit | 88b91af26e431a3b8a917ecc17fdd79a884225e2 (patch) | |
tree | 588350293e5fab1a024a7fb4a3b9c81c9c2de3cf | |
parent | b18894720abdca86c7d41fe9a75900050652da13 (diff) | |
download | jquery-88b91af26e431a3b8a917ecc17fdd79a884225e2.tar.gz jquery-88b91af26e431a3b8a917ecc17fdd79a884225e2.zip |
Core: fix isPlainObject(Object.create) test in IE
-rw-r--r-- | test/unit/core.js | 22 |
1 files changed, 13 insertions, 9 deletions
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 ); |