Skip to content

Commit 9748e43

Browse files
ConnorAthertonmarkelog
authored andcommitted
Tests: Add .extend test for defined accessor properties
Closes gh-2615
1 parent b078a62 commit 9748e43

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/unit/core.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,6 +1080,29 @@ QUnit.test( "jQuery.extend(Object, Object)", function( assert ) {
10801080
assert.deepEqual( options2, options2Copy, "Check if not modified: options2 must not be modified" );
10811081
} );
10821082

1083+
QUnit.test( "jQuery.extend(Object, Object {created with \"defineProperties\"})", function( assert ) {
1084+
assert.expect( 2 );
1085+
1086+
var definedObj = Object.defineProperties({}, {
1087+
"enumerableProp": {
1088+
get: function () {
1089+
return true;
1090+
},
1091+
enumerable: true
1092+
},
1093+
"nonenumerableProp": {
1094+
get: function () {
1095+
return true;
1096+
}
1097+
}
1098+
}),
1099+
accessorObj = {};
1100+
1101+
jQuery.extend( accessorObj, definedObj );
1102+
assert.equal( accessorObj.enumerableProp, true, "Verify that getters are transferred" );
1103+
assert.equal( accessorObj.nonenumerableProp, undefined, "Verify that non-enumerable getters are ignored" );
1104+
} );
1105+
10831106
QUnit.test( "jQuery.extend(true,{},{a:[], o:{}}); deep copy with array, followed by object", function( assert ) {
10841107
assert.expect( 2 );
10851108

0 commit comments

Comments
 (0)