mirror of
https://github.com/jquery/jquery.git
synced 2025-01-10 18:24:24 +00:00
Tests: Add .extend test for defined accessor properties
Closes gh-2615
This commit is contained in:
parent
b078a62013
commit
9748e436ad
@ -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 );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user