verifyProperty-restore-symbol.js (778B)
1 // Copyright (C) 2017 Leo Balter. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 description: > 6 verifyProperty allows restoring the original descriptor 7 includes: [propertyHelper.js] 8 features: [Symbol] 9 ---*/ 10 11 var obj; 12 var prop = Symbol(1); 13 var desc = { enumerable: true, configurable: true, writable: true, value: 42 }; 14 15 obj = {}; 16 Object.defineProperty(obj, prop, desc); 17 18 verifyProperty(obj, prop, desc); 19 20 assert.sameValue( 21 Object.prototype.hasOwnProperty.call(obj, prop), 22 false 23 ); 24 25 obj = {}; 26 Object.defineProperty(obj, prop, desc); 27 28 verifyProperty(obj, prop, desc, { restore: true }); 29 30 assert.sameValue( 31 Object.prototype.hasOwnProperty.call(obj, prop), 32 true 33 ); 34 assert.sameValue(obj[prop], 42); 35 36 reportCompare(0, 0);