Permalink
Browse files

Tests: Add .extend test for defined accessor properties

Closes gh-2615
  • Loading branch information...
ConnorAtherton authored and markelog committed Sep 25, 2015
1 parent b078a62 commit 9748e436ad80d6a2e1661ba4cf8d7391ed87c3ad
Showing with 23 additions and 0 deletions.
  1. +23 −0 test/unit/core.js
View
@@ -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 );

0 comments on commit 9748e43

Please sign in to comment.