OLD | NEW |
1 description("Test to ensure correct behaviour of Object.getOwnPropertyDescriptor
"); | 1 description("Test to ensure correct behaviour of Object.getOwnPropertyDescriptor
"); |
2 | 2 |
3 function descriptorShouldBe(object, property, expected) { | 3 function descriptorShouldBe(object, property, expected) { |
4 var test = 'Object.getOwnPropertyDescriptor('+object+", "+property+')'; | 4 var test = 'Object.getOwnPropertyDescriptor('+object+", "+property+')'; |
5 if ("writable" in expected) { | 5 if ("writable" in expected) { |
6 // shouldBe(test+'.writable', '' + expected.writable); | 6 // shouldBe(test+'.writable', '' + expected.writable); |
7 shouldBe(test+'.value', '' + expected.value); | 7 shouldBe(test+'.value', '' + expected.value); |
8 shouldBeFalse(test+".hasOwnProperty('get')"); | 8 shouldBeFalse(test+".hasOwnProperty('get')"); |
9 shouldBeFalse(test+".hasOwnProperty('set')"); | 9 shouldBeFalse(test+".hasOwnProperty('set')"); |
10 } else { | 10 } else { |
(...skipping 25 matching lines...) Expand all Loading... |
36 descriptorShouldBe("/(a)*/g.exec('a')", "'length'", {writable: true, enumerable:
false, configurable: false, value:2}); | 36 descriptorShouldBe("/(a)*/g.exec('a')", "'length'", {writable: true, enumerable:
false, configurable: false, value:2}); |
37 descriptorShouldBe("function(){}", "'length'", {writable: false, enumerable: fal
se, configurable: false, value:0}); | 37 descriptorShouldBe("function(){}", "'length'", {writable: false, enumerable: fal
se, configurable: false, value:0}); |
38 descriptorShouldBe("Math.sin", "'length'", {writable: false, enumerable: false,
configurable: false, value:1}); | 38 descriptorShouldBe("Math.sin", "'length'", {writable: false, enumerable: false,
configurable: false, value:1}); |
39 descriptorShouldBe("Math.sin", "'name'", {writable: false, enumerable: false, co
nfigurable: false, value:"'sin'"}); | 39 descriptorShouldBe("Math.sin", "'name'", {writable: false, enumerable: false, co
nfigurable: false, value:"'sin'"}); |
40 var global = this; | 40 var global = this; |
41 descriptorShouldBe("global", "'global'", {writable: true, enumerable: true, conf
igurable: false, value:"global"}); | 41 descriptorShouldBe("global", "'global'", {writable: true, enumerable: true, conf
igurable: false, value:"global"}); |
42 descriptorShouldBe("global", "'undefined'", {writable: false, enumerable: false,
configurable: false, value:"undefined"}); | 42 descriptorShouldBe("global", "'undefined'", {writable: false, enumerable: false,
configurable: false, value:"undefined"}); |
43 descriptorShouldBe("global", "'NaN'", {writable: false, enumerable: false, confi
gurable: false, value:"NaN"}); | 43 descriptorShouldBe("global", "'NaN'", {writable: false, enumerable: false, confi
gurable: false, value:"NaN"}); |
44 descriptorShouldBe("global", "'Infinity'", {writable: false, enumerable: false,
configurable: false, value:"Infinity"}); | 44 descriptorShouldBe("global", "'Infinity'", {writable: false, enumerable: false,
configurable: false, value:"Infinity"}); |
45 descriptorShouldBe("global", "'window'", {writable: false, enumerable: true, con
figurable: false, value:"global"}); | 45 descriptorShouldBe("global", "'window'", {writable: false, enumerable: true, con
figurable: false, value:"global"}); |
46 descriptorShouldBe("global", "'XMLHttpRequest'", {writable: true, enumerable: tr
ue, configurable: false, value:"XMLHttpRequest"}); | 46 descriptorShouldBe("global", "'XMLHttpRequest'", {writable: true, enumerable: fa
lse, configurable: true, value:"XMLHttpRequest"}); |
47 descriptorShouldBe("global", "'length'", {writable: true, enumerable: true, conf
igurable: false, value:"global.length"}); | 47 descriptorShouldBe("global", "'length'", {writable: true, enumerable: true, conf
igurable: false, value:"global.length"}); |
48 descriptorShouldBe("global", "0", {writable: true, enumerable: false, configurab
le: false, value:"global[0]"}); | 48 descriptorShouldBe("global", "0", {writable: true, enumerable: false, configurab
le: false, value:"global[0]"}); |
49 descriptorShouldBe("document.getElementsByTagName('div')", "'length'", {writable
: false, enumerable: true, configurable: false, value:"1"}); | 49 descriptorShouldBe("document.getElementsByTagName('div')", "'length'", {writable
: false, enumerable: true, configurable: false, value:"1"}); |
50 descriptorShouldBe("document.getElementsByTagName('div')", "0", {writable: false
, enumerable: true, configurable: false, value:"document.getElementsByTagName('d
iv')[0]"}); | 50 descriptorShouldBe("document.getElementsByTagName('div')", "0", {writable: false
, enumerable: true, configurable: false, value:"document.getElementsByTagName('d
iv')[0]"}); |
51 descriptorShouldBe("document.getElementsByClassName('pass')", "0", {writable: fa
lse, enumerable: true, configurable: false, value:"document.getElementsByClassNa
me('pass')[0]"}); | 51 descriptorShouldBe("document.getElementsByClassName('pass')", "0", {writable: fa
lse, enumerable: true, configurable: false, value:"document.getElementsByClassNa
me('pass')[0]"}); |
52 descriptorShouldBe("document.getElementsByClassName('pass')", "'length'", {writa
ble: false, enumerable: true, configurable: false, value:"document.getElementsBy
ClassName('pass').length"}); | 52 descriptorShouldBe("document.getElementsByClassName('pass')", "'length'", {writa
ble: false, enumerable: true, configurable: false, value:"document.getElementsBy
ClassName('pass').length"}); |
53 var canvas = document.createElement("canvas"); | 53 var canvas = document.createElement("canvas"); |
54 var canvasPixelArray = canvas.getContext("2d").createImageData(10,10).data; | 54 var canvasPixelArray = canvas.getContext("2d").createImageData(10,10).data; |
55 descriptorShouldBe("canvasPixelArray", "'length'", {writable: false, enumerable:
true, configurable: false, value:"canvasPixelArray.length"}); | 55 descriptorShouldBe("canvasPixelArray", "'length'", {writable: false, enumerable:
true, configurable: false, value:"canvasPixelArray.length"}); |
56 descriptorShouldBe("canvasPixelArray", "0", {writable: true, enumerable: true, c
onfigurable: false, value:"canvasPixelArray[0]"}); | 56 descriptorShouldBe("canvasPixelArray", "0", {writable: true, enumerable: true, c
onfigurable: false, value:"canvasPixelArray[0]"}); |
(...skipping 30 matching lines...) Expand all Loading... |
87 shouldBe('property', normalOrder[i++]); | 87 shouldBe('property', normalOrder[i++]); |
88 i = 0; | 88 i = 0; |
89 for (var property in Object.getOwnPropertyDescriptor(objectWithGetter, "getter")
) | 89 for (var property in Object.getOwnPropertyDescriptor(objectWithGetter, "getter")
) |
90 shouldBe('property', accessorOrder[i++]); | 90 shouldBe('property', accessorOrder[i++]); |
91 i = 0; | 91 i = 0; |
92 for (var property in Object.getOwnPropertyDescriptor(objectWithSetter, "setter")
) | 92 for (var property in Object.getOwnPropertyDescriptor(objectWithSetter, "setter")
) |
93 shouldBe('property', accessorOrder[i++]); | 93 shouldBe('property', accessorOrder[i++]); |
94 i = 0; | 94 i = 0; |
95 for (var property in Object.getOwnPropertyDescriptor(objectWithAccessor, "access
or")) | 95 for (var property in Object.getOwnPropertyDescriptor(objectWithAccessor, "access
or")) |
96 shouldBe('property', accessorOrder[i++]); | 96 shouldBe('property', accessorOrder[i++]); |
OLD | NEW |