Skip to content

Commit 15f7920

Browse files
committed
Tests: Add .extend test for defined accessor properties
Ref 9748e43 Closes gh-2615
1 parent f60729f commit 15f7920

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

test/unit/core.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,6 +1085,36 @@ QUnit.test( "jQuery.extend(Object, Object)", function( assert ) {
10851085
assert.deepEqual( options2, options2Copy, "Check if not modified: options2 must not be modified" );
10861086
} );
10871087

1088+
QUnit.test( "jQuery.extend(Object, Object {created with \"defineProperties\"})", function( assert ) {
1089+
1090+
// Support: IE8 only
1091+
if ( !( "defineProperties" in Object ) ) {
1092+
assert.expect( 0 );
1093+
return;
1094+
}
1095+
1096+
assert.expect( 2 );
1097+
1098+
var definedObj = Object.defineProperties({}, {
1099+
"enumerableProp": {
1100+
get: function () {
1101+
return true;
1102+
},
1103+
enumerable: true
1104+
},
1105+
"nonenumerableProp": {
1106+
get: function () {
1107+
return true;
1108+
}
1109+
}
1110+
}),
1111+
accessorObj = {};
1112+
1113+
jQuery.extend( accessorObj, definedObj );
1114+
assert.equal( accessorObj.enumerableProp, true, "Verify that getters are transferred" );
1115+
assert.equal( accessorObj.nonenumerableProp, undefined, "Verify that non-enumerable getters are ignored" );
1116+
} );
1117+
10881118
QUnit.test( "jQuery.each(Object,Function)", function( assert ) {
10891119
assert.expect( 23 );
10901120

0 commit comments

Comments
 (0)