| 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 properties, step 4.a.1 of |
| 8 |
[[DefineOwnProperty]] creates a data property if handed a generic desc. |
| 9 |
es5id: 15.2.3.6-4-4 |
| 10 |
description: > |
| 11 |
Object.defineProperty defines a data property if given a generic |
| 12 |
desc(8.12.9 step 4.a.i) |
| 13 |
---*/ |
| 14 |
|
| 15 |
var o = {}; |
| 16 |
|
| 17 |
var desc = {}; |
| 18 |
Object.defineProperty(o, "foo", desc); |
| 19 |
|
| 20 |
var propDesc = Object.getOwnPropertyDescriptor(o, "foo"); |
| 21 |
|
| 22 |
assert.sameValue(propDesc.value, undefined, 'propDesc.value'); // undefined by default |
| 23 |
assert.sameValue(propDesc.writable, false, 'propDesc.writable'); // false by default |
| 24 |
assert.sameValue(propDesc.enumerable, false, 'propDesc.enumerable'); // false by default |
| 25 |
assert.sameValue(propDesc.configurable, false, 'propDesc.configurable'); // false by default |