diff options
author | Connor Atherton <c.liam.atherton@gmail.com> | 2015-09-25 12:02:53 -0700 |
---|---|---|
committer | Oleg Gaidarenko <markelog@gmail.com> | 2015-10-12 17:19:20 +0300 |
commit | 9748e436ad80d6a2e1661ba4cf8d7391ed87c3ad (patch) | |
tree | 82f663f939f31fc3d0380ec4dba5ac18d1e6af3c | |
parent | b078a62013782c7424a4a61a240c23c4c0b42614 (diff) | |
download | jquery-9748e436ad80d6a2e1661ba4cf8d7391ed87c3ad.tar.gz jquery-9748e436ad80d6a2e1661ba4cf8d7391ed87c3ad.zip |
Tests: Add .extend test for defined accessor properties
Closes gh-2615
-rw-r--r-- | test/unit/core.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/unit/core.js b/test/unit/core.js index a899e1365..407ae7e2c 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -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 ); |