Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperty/15.2.3.6-4-588.js

raw
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 es5id: 15.2.3.6-4-588
6 description: >
7 ES5 Attributes - [[Get]] field of inherited property of
8 [[Prototype]] internal property is correct (Object.create)
9 ---*/
10
11 var appointment = {};
12
13 var data1 = 1001;
14 Object.defineProperty(appointment, "startTime", {
15 get: function() {
16 return data1;
17 },
18 enumerable: true,
19 configurable: false
20 });
21 var data2 = "NAME";
22 Object.defineProperty(appointment, "name", {
23 get: function() {
24 return data2;
25 },
26 set: function(value) {
27 data2 = value;
28 },
29 enumerable: true,
30 configurable: true
31 });
32
33 var meeting = Object.create(appointment);
34 var data3 = "In-person meeting";
35 Object.defineProperty(meeting, "conferenceCall", {
36 get: function() {
37 return data3;
38 },
39 enumerable: true,
40 configurable: false
41 });
42
43 var teamMeeting = Object.create(meeting);
44
45 var hasOwnProperty = !teamMeeting.hasOwnProperty("name") &&
46 !teamMeeting.hasOwnProperty("startTime") &&
47 !teamMeeting.hasOwnProperty('conferenceCall');
48
49 assert(hasOwnProperty, 'hasOwnProperty !== true');
50 assert.sameValue(teamMeeting.name, "NAME", 'teamMeeting.name');
51 assert.sameValue(teamMeeting.startTime, 1001, 'teamMeeting.startTime');
52 assert.sameValue(teamMeeting.conferenceCall, "In-person meeting", 'teamMeeting.conferenceCall');