15.2.3.6-4-2.js (1053B)
1 // Copyright (c) 2012 Ecma International. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 info: | 6 Step 4 of defineProperty calls the [[DefineOwnProperty]] internal method 7 of O to define the property. For newly defined data properties, attributes 8 missing from desc should have values set to the defaults from 8.6.1. 9 es5id: 15.2.3.6-4-2 10 description: > 11 Object.defineProperty sets missing attributes to their default 12 values (data properties)(8.12.9 step 4.a.i) 13 ---*/ 14 15 var o = {}; 16 17 var desc = { 18 value: 1 19 }; 20 Object.defineProperty(o, "foo", desc); 21 22 var propDesc = Object.getOwnPropertyDescriptor(o, "foo"); 23 24 assert.sameValue(propDesc.value, 1, 'propDesc.value'); // this is the value that was set 25 assert.sameValue(propDesc.writable, false, 'propDesc.writable'); // false by default 26 assert.sameValue(propDesc.enumerable, false, 'propDesc.enumerable'); // false by default 27 assert.sameValue(propDesc.configurable, false, 'propDesc.configurable'); // false by default 28 29 reportCompare(0, 0);