15.2.3.6-4-589.js (1665B)
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-589 6 description: > 7 ES5 Attributes - Success to update value of property into of 8 [[Proptotype]] internal property (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 set: function(value) { 19 data1 = value; 20 }, 21 enumerable: true, 22 configurable: true 23 }); 24 var data2 = "NAME"; 25 Object.defineProperty(appointment, "name", { 26 get: function() { 27 return data2; 28 }, 29 set: function(value) { 30 data2 = value; 31 }, 32 enumerable: true, 33 configurable: false 34 }); 35 36 var meeting = Object.create(appointment); 37 var data3 = "In-person meeting"; 38 Object.defineProperty(meeting, "conferenceCall", { 39 get: function() { 40 return data3; 41 }, 42 set: function(value) { 43 data3 = value; 44 }, 45 enumerable: true, 46 configurable: false 47 }); 48 49 var teamMeeting = Object.create(meeting); 50 teamMeeting.name = "Team Meeting"; 51 var dateObj = new Date("10/31/2010 08:00"); 52 teamMeeting.startTime = dateObj; 53 teamMeeting.conferenceCall = "4255551212"; 54 55 var hasOwnProperty = !teamMeeting.hasOwnProperty("name") && 56 !teamMeeting.hasOwnProperty("startTime") && 57 !teamMeeting.hasOwnProperty('conferenceCall'); 58 59 assert(hasOwnProperty, 'hasOwnProperty !== true'); 60 assert.sameValue(teamMeeting.name, "Team Meeting", 'teamMeeting.name'); 61 assert.sameValue(teamMeeting.startTime, dateObj, 'teamMeeting.startTime'); 62 assert.sameValue(teamMeeting.conferenceCall, "4255551212", 'teamMeeting.conferenceCall'); 63 64 reportCompare(0, 0);