Skip to content

Commit

Permalink
Tests: Add .extend test for defined accessor properties
Browse files Browse the repository at this point in the history
Closes gh-2615
  • Loading branch information
ConnorAtherton authored and markelog committed Oct 12, 2015
1 parent b078a62 commit 9748e43
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/unit/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1080,6 +1080,29 @@ QUnit.test( "jQuery.extend(Object, Object)", function( assert ) {
assert.deepEqual( options2, options2Copy, "Check if not modified: options2 must not be modified" );
} );

QUnit.test( "jQuery.extend(Object, Object {created with \"defineProperties\"})", function( assert ) {
assert.expect( 2 );

var definedObj = Object.defineProperties({}, {
"enumerableProp": {
get: function () {
return true;
},
enumerable: true
},
"nonenumerableProp": {
get: function () {
return true;
}
}
}),
accessorObj = {};

jQuery.extend( accessorObj, definedObj );
assert.equal( accessorObj.enumerableProp, true, "Verify that getters are transferred" );
assert.equal( accessorObj.nonenumerableProp, undefined, "Verify that non-enumerable getters are ignored" );
} );

QUnit.test( "jQuery.extend(true,{},{a:[], o:{}}); deep copy with array, followed by object", function( assert ) {
assert.expect( 2 );

Expand Down

0 comments on commit 9748e43

Please sign in to comment.