| 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 |
| 11 var testObject = {nyannyan: 123}; | 11 var testObject = {nyannyan: 123}; |
| 12 | 12 |
| 13 // No initializer is passed. | 13 // No initializer is passed. |
| 14 shouldBe("new KeyboardEvent('eventType').bubbles", "false"); | 14 shouldBe("new KeyboardEvent('eventType').bubbles", "false"); |
| 15 shouldBe("new KeyboardEvent('eventType').cancelable", "false"); | 15 shouldBe("new KeyboardEvent('eventType').cancelable", "false"); |
| 16 shouldBe("new KeyboardEvent('eventType').view", "null"); | 16 shouldBe("new KeyboardEvent('eventType').view", "null"); |
| 17 shouldBe("new KeyboardEvent('eventType').detail", "0"); | 17 shouldBe("new KeyboardEvent('eventType').detail", "0"); |
| 18 shouldBeEqualToString("new KeyboardEvent('eventType').keyIdentifier", ""); | 18 shouldBeEqualToString("new KeyboardEvent('eventType').keyIdentifier", ""); |
| 19 shouldBe("new KeyboardEvent('eventType').keyLocation", "0"); | 19 shouldBe("new KeyboardEvent('eventType').location", "0"); |
| 20 shouldBe("new KeyboardEvent('eventType').ctrlKey", "false"); | 20 shouldBe("new KeyboardEvent('eventType').ctrlKey", "false"); |
| 21 shouldBe("new KeyboardEvent('eventType').altKey", "false"); | 21 shouldBe("new KeyboardEvent('eventType').altKey", "false"); |
| 22 shouldBe("new KeyboardEvent('eventType').shiftKey", "false"); | 22 shouldBe("new KeyboardEvent('eventType').shiftKey", "false"); |
| 23 shouldBe("new KeyboardEvent('eventType').metaKey", "false"); | 23 shouldBe("new KeyboardEvent('eventType').metaKey", "false"); |
| 24 | 24 |
| 25 // bubbles is passed. | 25 // bubbles is passed. |
| 26 shouldBe("new KeyboardEvent('eventType', { bubbles: false }).bubbles", "false"); | 26 shouldBe("new KeyboardEvent('eventType', { bubbles: false }).bubbles", "false"); |
| 27 shouldBe("new KeyboardEvent('eventType', { bubbles: true }).bubbles", "true"); | 27 shouldBe("new KeyboardEvent('eventType', { bubbles: true }).bubbles", "true"); |
| 28 | 28 |
| 29 // cancelable is passed. | 29 // cancelable is passed. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: false }).
keyIdentifier", "false"); | 63 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: false }).
keyIdentifier", "false"); |
| 64 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: true }).k
eyIdentifier", "true"); | 64 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: true }).k
eyIdentifier", "true"); |
| 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 // keyLocation 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"); |
| 76 shouldBe("new KeyboardEvent('eventType', { location: 1 }).location", "1"); |
| 77 shouldBe("new KeyboardEvent('eventType', { location: 4294967294 }).location", "4
294967294"); |
| 78 shouldBe("new KeyboardEvent('eventType', { location: 4294967295 }).location", "4
294967295"); |
| 79 |
| 80 // test for deprecated 'keyLocation'. |
| 75 shouldBe("new KeyboardEvent('eventType', { keyLocation: 0 }).keyLocation", "0"); | 81 shouldBe("new KeyboardEvent('eventType', { keyLocation: 0 }).keyLocation", "0"); |
| 76 shouldBe("new KeyboardEvent('eventType', { keyLocation: 1 }).keyLocation", "1"); | 82 shouldBe("new KeyboardEvent('eventType', { keyLocation: 1 }).keyLocation", "1"); |
| 77 shouldBe("new KeyboardEvent('eventType', { keyLocation: 4294967294 }).keyLocatio
n", "4294967294"); | 83 shouldBe("new KeyboardEvent('eventType', { keyLocation: 1 }).location", "1"); |
| 78 shouldBe("new KeyboardEvent('eventType', { keyLocation: 4294967295 }).keyLocatio
n", "4294967295"); | 84 shouldBe("new KeyboardEvent('eventType', { location: 1 }).keyLocation", "1"); |
| 79 | 85 |
| 80 // numbers out of the unsigned long range. | 86 // numbers out of the unsigned long range. |
| 81 // 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. |
| 82 shouldBe("new KeyboardEvent('eventType', { keyLocation: 9007199254740991 }).keyL
ocation", "4294967295"); | 88 shouldBe("new KeyboardEvent('eventType', { location: 9007199254740991 }).locatio
n", "4294967295"); |
| 83 // 2^{64}-1 | 89 // 2^{64}-1 |
| 84 shouldBe("new KeyboardEvent('eventType', { keyLocation: 18446744073709551615 }).
keyLocation", "0"); | 90 shouldBe("new KeyboardEvent('eventType', { location: 18446744073709551615 }).loc
ation", "0"); |
| 85 shouldBe("new KeyboardEvent('eventType', { keyLocation: 12345678901234567890 }).
keyLocation", "3944679424"); | 91 shouldBe("new KeyboardEvent('eventType', { location: 12345678901234567890 }).loc
ation", "3944679424"); |
| 86 shouldBe("new KeyboardEvent('eventType', { keyLocation: -1 }).keyLocation", "429
4967295"); | 92 shouldBe("new KeyboardEvent('eventType', { location: -1 }).location", "429496729
5"); |
| 87 shouldBe("new KeyboardEvent('eventType', { keyLocation: 123.45 }).keyLocation",
"123"); | 93 shouldBe("new KeyboardEvent('eventType', { location: 123.45 }).location", "123")
; |
| 88 shouldBe("new KeyboardEvent('eventType', { keyLocation: NaN }).keyLocation", "0"
); | 94 shouldBe("new KeyboardEvent('eventType', { location: NaN }).location", "0"); |
| 89 | 95 |
| 90 // Non-numeric values. | 96 // Non-numeric values. |
| 91 shouldBe("new KeyboardEvent('eventType', { keyLocation: undefined }).keyLocation
", "0"); | 97 shouldBe("new KeyboardEvent('eventType', { location: undefined }).location", "0"
); |
| 92 shouldBe("new KeyboardEvent('eventType', { keyLocation: null }).keyLocation", "0
"); | 98 shouldBe("new KeyboardEvent('eventType', { location: null }).location", "0"); |
| 93 shouldBe("new KeyboardEvent('eventType', { keyLocation: '' }).keyLocation", "0")
; | 99 shouldBe("new KeyboardEvent('eventType', { location: '' }).location", "0"); |
| 94 shouldBe("new KeyboardEvent('eventType', { keyLocation: '12345' }).keyLocation",
"12345"); | 100 shouldBe("new KeyboardEvent('eventType', { location: '12345' }).location", "1234
5"); |
| 95 shouldBe("new KeyboardEvent('eventType', { keyLocation: '12345a' }).keyLocation"
, "0"); | 101 shouldBe("new KeyboardEvent('eventType', { location: '12345a' }).location", "0")
; |
| 96 shouldBe("new KeyboardEvent('eventType', { keyLocation: 'abc' }).keyLocation", "
0"); | 102 shouldBe("new KeyboardEvent('eventType', { location: 'abc' }).location", "0"); |
| 97 shouldBe("new KeyboardEvent('eventType', { keyLocation: [] }).keyLocation", "0")
; | 103 shouldBe("new KeyboardEvent('eventType', { location: [] }).location", "0"); |
| 98 shouldBe("new KeyboardEvent('eventType', { keyLocation: [12345] }).keyLocation",
"12345"); | 104 shouldBe("new KeyboardEvent('eventType', { location: [12345] }).location", "1234
5"); |
| 99 shouldBe("new KeyboardEvent('eventType', { keyLocation: [12345, 67890] }).keyLoc
ation", "0"); | 105 shouldBe("new KeyboardEvent('eventType', { location: [12345, 67890] }).location"
, "0"); |
| 100 shouldBe("new KeyboardEvent('eventType', { keyLocation: {} }).keyLocation", "0")
; | 106 shouldBe("new KeyboardEvent('eventType', { location: {} }).location", "0"); |
| 101 shouldBe("new KeyboardEvent('eventType', { keyLocation: {moemoe: 12345} }).keyLo
cation", "0"); | 107 shouldBe("new KeyboardEvent('eventType', { location: {moemoe: 12345} }).location
", "0"); |
| 102 shouldBe("new KeyboardEvent('eventType', { keyLocation: {valueOf: function () {
return 12345; }} }).keyLocation", "12345"); | 108 shouldBe("new KeyboardEvent('eventType', { location: {valueOf: function () { ret
urn 12345; }} }).location", "12345"); |
| 103 | 109 |
| 104 // ctrlKey, altKey, shiftKey and metaKey are passed. | 110 // ctrlKey, altKey, shiftKey and metaKey are passed. |
| 105 ["ctrlKey", "altKey", "shiftKey", "metaKey"].forEach(function (attr) { | 111 ["ctrlKey", "altKey", "shiftKey", "metaKey"].forEach(function (attr) { |
| 106 shouldBe("new KeyboardEvent('eventType', { " + attr + ": false })." + attr,
"false"); | 112 shouldBe("new KeyboardEvent('eventType', { " + attr + ": false })." + attr,
"false"); |
| 107 shouldBe("new KeyboardEvent('eventType', { " + attr + ": true })." + attr, "
true"); | 113 shouldBe("new KeyboardEvent('eventType', { " + attr + ": true })." + attr, "
true"); |
| 108 }); | 114 }); |
| 109 | 115 |
| 110 // All initializers are passed. | 116 // All initializers are passed. |
| 111 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view
: window, detail: 111, keyIdentifier: 'chocolate', keyLocation: 222, ctrlKey: tr
ue, 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"); |
| 112 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view
: window, detail: 111, keyIdentifier: 'chocolate', keyLocation: 222, ctrlKey: tr
ue, 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"); |
| 113 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view
: window, detail: 111, keyIdentifier: 'chocolate', keyLocation: 222, ctrlKey: tr
ue, 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"); |
| 114 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view
: window, detail: 111, keyIdentifier: 'chocolate', keyLocation: 222, ctrlKey: tr
ue, 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"); |
| 115 shouldBeEqualToString("new KeyboardEvent('eventType', { bubbles: true, cancelabl
e: true, view: window, detail: 111, keyIdentifier: 'chocolate', keyLocation: 222
, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).keyIdentifier",
"chocolate"); | 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"); |
| 116 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view
: window, detail: 111, keyIdentifier: 'chocolate', keyLocation: 222, ctrlKey: tr
ue, altKey: true, shiftKey: true, metaKey: true }).keyLocation", "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"); |
| 117 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view
: window, detail: 111, keyIdentifier: 'chocolate', keyLocation: 222, ctrlKey: tr
ue, 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"); |
| 118 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view
: window, detail: 111, keyIdentifier: 'chocolate', keyLocation: 222, ctrlKey: tr
ue, 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"); |
| 119 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view
: window, detail: 111, keyIdentifier: 'chocolate', keyLocation: 222, ctrlKey: tr
ue, 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"); |
| 120 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view
: window, detail: 111, keyIdentifier: 'chocolate', keyLocation: 222, ctrlKey: tr
ue, 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"); |
| 121 </script> | 127 </script> |
| 122 <script src="../../js/resources/js-test-post.js"></script> | 128 <script src="../../js/resources/js-test-post.js"></script> |
| 123 </body> | 129 </body> |
| 124 </html> | 130 </html> |
| OLD | NEW |