OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../js/resources/js-test-pre.js"></script> | 4 <script src="../../js/resources/js-test-pre.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <script> | 7 <script> |
8 | 8 |
9 description("This tests the constructor for the KeyboardEvent DOM class."); | 9 description("This tests the constructor for the KeyboardEvent DOM class."); |
10 | 10 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: 12345 }).
keyIdentifier", "12345"); | 65 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: 12345 }).
keyIdentifier", "12345"); |
66 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: 184467440
73709551615 }).keyIdentifier", "18446744073709552000"); | 66 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: 184467440
73709551615 }).keyIdentifier", "18446744073709552000"); |
67 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: NaN }).ke
yIdentifier", "NaN"); | 67 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: NaN }).ke
yIdentifier", "NaN"); |
68 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: [] }).key
Identifier", ""); | 68 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: [] }).key
Identifier", ""); |
69 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: [1, 2, 3]
}).keyIdentifier", "1,2,3"); | 69 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: [1, 2, 3]
}).keyIdentifier", "1,2,3"); |
70 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: {koakuma:
12345} }).keyIdentifier", "[object Object]"); | 70 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: {koakuma:
12345} }).keyIdentifier", "[object Object]"); |
71 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: {valueOf:
function () { return 'koakuma'; } } }).keyIdentifier", "[object Object]"); | 71 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: {valueOf:
function () { return 'koakuma'; } } }).keyIdentifier", "[object Object]"); |
72 | 72 |
73 // location is passed. | 73 // location is passed. |
74 // numbers within the unsigned long range. | 74 // numbers within the unsigned long range. |
75 shouldBe("new KeyboardEvent('eventType', { location: 0 }).location", "0"); | 75 shouldBe("new KeyboardEvent('eventType', { location: KeyboardEvent.DOM_KEY_LOCAT
ION_STANDARD }).location", "KeyboardEvent.DOM_KEY_LOCATION_STANDARD"); |
76 shouldBe("new KeyboardEvent('eventType', { location: 1 }).location", "1"); | 76 shouldBe("new KeyboardEvent('eventType', { location: KeyboardEvent.DOM_KEY_LOCAT
ION_LEFT }).location", "KeyboardEvent.DOM_KEY_LOCATION_LEFT"); |
77 shouldBe("new KeyboardEvent('eventType', { location: 4294967294 }).location", "4
294967294"); | 77 shouldBe("new KeyboardEvent('eventType', { location: 4294967294 }).location", "4
294967294"); |
78 shouldBe("new KeyboardEvent('eventType', { location: 4294967295 }).location", "4
294967295"); | 78 shouldBe("new KeyboardEvent('eventType', { location: 4294967295 }).location", "4
294967295"); |
79 | 79 |
80 // test for deprecated 'keyLocation'. | 80 // test for deprecated 'keyLocation'. |
81 shouldBe("new KeyboardEvent('eventType', { keyLocation: 0 }).keyLocation", "0"); | 81 shouldBe("new KeyboardEvent('eventType', { keyLocation: 0 }).keyLocation", "0"); |
82 shouldBe("new KeyboardEvent('eventType', { keyLocation: 1 }).keyLocation", "1"); | 82 shouldBe("new KeyboardEvent('eventType', { keyLocation: 1 }).keyLocation", "1"); |
83 shouldBe("new KeyboardEvent('eventType', { keyLocation: 1 }).location", "1"); | 83 shouldBe("new KeyboardEvent('eventType', { keyLocation: 1 }).location", "1"); |
84 shouldBe("new KeyboardEvent('eventType', { location: 1 }).keyLocation", "1"); | 84 shouldBe("new KeyboardEvent('eventType', { location: 1 }).keyLocation", "1"); |
85 | 85 |
86 // numbers out of the unsigned long range. | 86 // numbers out of the unsigned long range. |
87 // 2^{53}-1, the largest number that can be exactly represented by double. | 87 // 2^{53}-1, the largest number that can be exactly represented by double. |
88 shouldBe("new KeyboardEvent('eventType', { location: 9007199254740991 }).locatio
n", "4294967295"); | 88 shouldBe("new KeyboardEvent('eventType', { location: 9007199254740991 }).locatio
n", "4294967295"); |
89 // 2^{64}-1 | 89 // 2^{64}-1 |
90 shouldBe("new KeyboardEvent('eventType', { location: 18446744073709551615 }).loc
ation", "0"); | 90 shouldBe("new KeyboardEvent('eventType', { location: 18446744073709551615 }).loc
ation", "KeyboardEvent.DOM_KEY_LOCATION_STANDARD"); |
91 shouldBe("new KeyboardEvent('eventType', { location: 12345678901234567890 }).loc
ation", "3944679424"); | 91 shouldBe("new KeyboardEvent('eventType', { location: 12345678901234567890 }).loc
ation", "3944679424"); |
92 shouldBe("new KeyboardEvent('eventType', { location: -1 }).location", "429496729
5"); | 92 shouldBe("new KeyboardEvent('eventType', { location: -1 }).location", "429496729
5"); |
93 shouldBe("new KeyboardEvent('eventType', { location: 123.45 }).location", "123")
; | 93 shouldBe("new KeyboardEvent('eventType', { location: 123.45 }).location", "123")
; |
94 shouldBe("new KeyboardEvent('eventType', { location: NaN }).location", "0"); | 94 shouldBe("new KeyboardEvent('eventType', { location: NaN }).location", "Keyboard
Event.DOM_KEY_LOCATION_STANDARD"); |
95 | 95 |
96 // Non-numeric values. | 96 // Non-numeric values. |
97 shouldBe("new KeyboardEvent('eventType', { location: undefined }).location", "0"
); | 97 shouldBe("new KeyboardEvent('eventType', { location: undefined }).location", "Ke
yboardEvent.DOM_KEY_LOCATION_STANDARD"); |
98 shouldBe("new KeyboardEvent('eventType', { location: null }).location", "0"); | 98 shouldBe("new KeyboardEvent('eventType', { location: null }).location", "Keyboar
dEvent.DOM_KEY_LOCATION_STANDARD"); |
99 shouldBe("new KeyboardEvent('eventType', { location: '' }).location", "0"); | 99 shouldBe("new KeyboardEvent('eventType', { location: '' }).location", "KeyboardE
vent.DOM_KEY_LOCATION_STANDARD"); |
100 shouldBe("new KeyboardEvent('eventType', { location: '12345' }).location", "1234
5"); | 100 shouldBe("new KeyboardEvent('eventType', { location: '12345' }).location", "1234
5"); |
101 shouldBe("new KeyboardEvent('eventType', { location: '12345a' }).location", "0")
; | 101 shouldBe("new KeyboardEvent('eventType', { location: '12345a' }).location", "Key
boardEvent.DOM_KEY_LOCATION_STANDARD"); |
102 shouldBe("new KeyboardEvent('eventType', { location: 'abc' }).location", "0"); | 102 shouldBe("new KeyboardEvent('eventType', { location: 'abc' }).location", "Keyboa
rdEvent.DOM_KEY_LOCATION_STANDARD"); |
103 shouldBe("new KeyboardEvent('eventType', { location: [] }).location", "0"); | 103 shouldBe("new KeyboardEvent('eventType', { location: [] }).location", "KeyboardE
vent.DOM_KEY_LOCATION_STANDARD"); |
104 shouldBe("new KeyboardEvent('eventType', { location: [12345] }).location", "1234
5"); | 104 shouldBe("new KeyboardEvent('eventType', { location: [12345] }).location", "1234
5"); |
105 shouldBe("new KeyboardEvent('eventType', { location: [12345, 67890] }).location"
, "0"); | 105 shouldBe("new KeyboardEvent('eventType', { location: [12345, 67890] }).location"
, "KeyboardEvent.DOM_KEY_LOCATION_STANDARD"); |
106 shouldBe("new KeyboardEvent('eventType', { location: {} }).location", "0"); | 106 shouldBe("new KeyboardEvent('eventType', { location: {} }).location", "KeyboardE
vent.DOM_KEY_LOCATION_STANDARD"); |
107 shouldBe("new KeyboardEvent('eventType', { location: {moemoe: 12345} }).location
", "0"); | 107 shouldBe("new KeyboardEvent('eventType', { location: {moemoe: 12345} }).location
", "KeyboardEvent.DOM_KEY_LOCATION_STANDARD"); |
108 shouldBe("new KeyboardEvent('eventType', { location: {valueOf: function () { ret
urn 12345; }} }).location", "12345"); | 108 shouldBe("new KeyboardEvent('eventType', { location: {valueOf: function () { ret
urn 12345; }} }).location", "12345"); |
109 | 109 |
110 // ctrlKey, altKey, shiftKey and metaKey are passed. | 110 // ctrlKey, altKey, shiftKey and metaKey are passed. |
111 ["ctrlKey", "altKey", "shiftKey", "metaKey"].forEach(function (attr) { | 111 ["ctrlKey", "altKey", "shiftKey", "metaKey"].forEach(function (attr) { |
112 shouldBe("new KeyboardEvent('eventType', { " + attr + ": false })." + attr,
"false"); | 112 shouldBe("new KeyboardEvent('eventType', { " + attr + ": false })." + attr,
"false"); |
113 shouldBe("new KeyboardEvent('eventType', { " + attr + ": true })." + attr, "
true"); | 113 shouldBe("new KeyboardEvent('eventType', { " + attr + ": true })." + attr, "
true"); |
114 }); | 114 }); |
115 | 115 |
116 // All initializers are passed. | 116 // All initializers are passed. |
117 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view
: window, detail: 111, keyIdentifier: 'chocolate', location: 222, ctrlKey: true,
altKey: true, shiftKey: true, metaKey: true }).bubbles", "true"); | 117 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view
: window, detail: 111, keyIdentifier: 'chocolate', location: 222, ctrlKey: true,
altKey: true, shiftKey: true, metaKey: true }).bubbles", "true"); |
118 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view
: window, detail: 111, keyIdentifier: 'chocolate', location: 222, ctrlKey: true,
altKey: true, shiftKey: true, metaKey: true }).cancelable", "true"); | 118 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view
: window, detail: 111, keyIdentifier: 'chocolate', location: 222, ctrlKey: true,
altKey: true, shiftKey: true, metaKey: true }).cancelable", "true"); |
119 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view
: window, detail: 111, keyIdentifier: 'chocolate', location: 222, ctrlKey: true,
altKey: true, shiftKey: true, metaKey: true }).view", "window"); | 119 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view
: window, detail: 111, keyIdentifier: 'chocolate', location: 222, ctrlKey: true,
altKey: true, shiftKey: true, metaKey: true }).view", "window"); |
120 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view
: window, detail: 111, keyIdentifier: 'chocolate', location: 222, ctrlKey: true,
altKey: true, shiftKey: true, metaKey: true }).detail", "111"); | 120 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view
: window, detail: 111, keyIdentifier: 'chocolate', location: 222, ctrlKey: true,
altKey: true, shiftKey: true, metaKey: true }).detail", "111"); |
121 shouldBeEqualToString("new KeyboardEvent('eventType', { bubbles: true, cancelabl
e: true, view: window, detail: 111, keyIdentifier: 'chocolate', location: 222, c
trlKey: true, altKey: true, shiftKey: true, metaKey: true }).keyIdentifier", "ch
ocolate"); | 121 shouldBeEqualToString("new KeyboardEvent('eventType', { bubbles: true, cancelabl
e: true, view: window, detail: 111, keyIdentifier: 'chocolate', location: 222, c
trlKey: true, altKey: true, shiftKey: true, metaKey: true }).keyIdentifier", "ch
ocolate"); |
122 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view
: window, detail: 111, keyIdentifier: 'chocolate', location: 222, ctrlKey: true,
altKey: true, shiftKey: true, metaKey: true }).location", "222"); | 122 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view
: window, detail: 111, keyIdentifier: 'chocolate', location: 222, ctrlKey: true,
altKey: true, shiftKey: true, metaKey: true }).location", "222"); |
123 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view
: window, detail: 111, keyIdentifier: 'chocolate', location: 222, ctrlKey: true,
altKey: true, shiftKey: true, metaKey: true }).ctrlKey", "true"); | 123 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view
: window, detail: 111, keyIdentifier: 'chocolate', location: 222, ctrlKey: true,
altKey: true, shiftKey: true, metaKey: true }).ctrlKey", "true"); |
124 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view
: window, detail: 111, keyIdentifier: 'chocolate', location: 222, ctrlKey: true,
altKey: true, shiftKey: true, metaKey: true }).altKey", "true"); | 124 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view
: window, detail: 111, keyIdentifier: 'chocolate', location: 222, ctrlKey: true,
altKey: true, shiftKey: true, metaKey: true }).altKey", "true"); |
125 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view
: window, detail: 111, keyIdentifier: 'chocolate', location: 222, ctrlKey: true,
altKey: true, shiftKey: true, metaKey: true }).shiftKey", "true"); | 125 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view
: window, detail: 111, keyIdentifier: 'chocolate', location: 222, ctrlKey: true,
altKey: true, shiftKey: true, metaKey: true }).shiftKey", "true"); |
126 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view
: window, detail: 111, keyIdentifier: 'chocolate', location: 222, ctrlKey: true,
altKey: true, shiftKey: true, metaKey: true }).metaKey", "true"); | 126 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view
: window, detail: 111, keyIdentifier: 'chocolate', location: 222, ctrlKey: true,
altKey: true, shiftKey: true, metaKey: true }).metaKey", "true"); |
127 </script> | 127 </script> |
128 <script src="../../js/resources/js-test-post.js"></script> | 128 <script src="../../js/resources/js-test-post.js"></script> |
129 </body> | 129 </body> |
130 </html> | 130 </html> |
OLD | NEW |