From 728ea2f27720a351a014b698fd66d25075c0c5e3 Mon Sep 17 00:00:00 2001 From: Oleg Gaidarenko Date: Sat, 12 Mar 2016 16:40:41 +0300 Subject: [PATCH] Tests: add additional test for jQuery.isPlainObject Ref 00575d4d8c7421c5119f181009374ff2e7736127 Also see discussion in https://github.com/jquery/jquery/pull/2970#discussion_r54970557 --- test/unit/core.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/unit/core.js b/test/unit/core.js index d71539c02..2f4831828 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -365,7 +365,6 @@ QUnit.asyncTest( "isPlainObject", function( assert ) { } } ); -// QUnit[ typeof Symbol === "function" ? "test" : "skip" ]( "isPlainObject(Symbol)", function( assert ) { assert.expect( 2 ); @@ -373,6 +372,17 @@ QUnit[ typeof Symbol === "function" ? "test" : "skip" ]( "isPlainObject(Symbol)" assert.equal( jQuery.isPlainObject( Object( Symbol() ) ), false, "Symbol inside an object" ); } ); +QUnit[ "assign" in Object ? "test" : "skip" ]( "isPlainObject(Object.assign(...))", + function( assert ) { + assert.expect( 1 ); + + var parentObj = { foo: "bar" }; + var childObj = Object.assign( Object.create( parentObj ), { bar: "foo" } ); + + assert.ok( !jQuery.isPlainObject( childObj ), "isPlainObject(Object.assign(...))" ); + } +); + QUnit.test( "isFunction", function( assert ) { assert.expect( 19 ); -- 2.39.5