OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../../resources/js-test.js"></script> | 4 <script src="../../../resources/js-test.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <script> | 7 <script> |
8 | 8 |
9 description("This tests the constructor for the MouseEvent DOM class."); | 9 description("This tests the constructor for the MouseEvent DOM class."); |
10 | 10 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 shouldBe("new MouseEvent('eventType', { " + attr + ": {valueOf: function ()
{ return 12345; }} })." + attr, "12345"); | 96 shouldBe("new MouseEvent('eventType', { " + attr + ": {valueOf: function ()
{ return 12345; }} })." + attr, "12345"); |
97 }); | 97 }); |
98 | 98 |
99 // ctrlKey, altKey, shiftKey and metaKey are passed. | 99 // ctrlKey, altKey, shiftKey and metaKey are passed. |
100 ["ctrlKey", "altKey", "shiftKey", "metaKey"].forEach(function (attr) { | 100 ["ctrlKey", "altKey", "shiftKey", "metaKey"].forEach(function (attr) { |
101 shouldBe("new MouseEvent('eventType', { " + attr + ": false })." + attr, "fa
lse"); | 101 shouldBe("new MouseEvent('eventType', { " + attr + ": false })." + attr, "fa
lse"); |
102 shouldBe("new MouseEvent('eventType', { " + attr + ": true })." + attr, "tru
e"); | 102 shouldBe("new MouseEvent('eventType', { " + attr + ": true })." + attr, "tru
e"); |
103 }); | 103 }); |
104 | 104 |
105 // button is passed. | 105 // button is passed. |
106 // Numbers within the unsigned short range. | 106 // Numbers within the short range. |
107 shouldBe("new MouseEvent('eventType', { button: 0 }).button", "0"); | 107 shouldBe("new MouseEvent('eventType', { button: 0 }).button", "0"); |
108 shouldBe("new MouseEvent('eventType', { button: 1 }).button", "1"); | 108 shouldBe("new MouseEvent('eventType', { button: 1 }).button", "1"); |
109 shouldBe("new MouseEvent('eventType', { button: 65534 }).button", "65534"); | 109 shouldBe("new MouseEvent('eventType', { button: -2 }).button", "-2"); |
| 110 shouldBe("new MouseEvent('eventType', { button: -32768 }).button", "-32768"); |
| 111 shouldBe("new MouseEvent('eventType', { button: 32767 }).button", "32767"); |
110 | 112 |
111 // Numbers that are equal to ((unsigned short)-1) should be treated as 0. | 113 // Numbers that are equal to -1 should be treated as 0. |
112 shouldBe("new MouseEvent('eventType', { button: 65535 }).button", "0"); | 114 shouldBe("new MouseEvent('eventType', { button: 65535 }).button", "0"); |
113 shouldBe("new MouseEvent('eventType', { button: 9007199254740991 }).button", "0"
); | 115 shouldBe("new MouseEvent('eventType', { button: 9007199254740991 }).button", "0"
); |
114 shouldBe("new MouseEvent('eventType', { button: -1 }).button", "0"); | 116 shouldBe("new MouseEvent('eventType', { button: -1 }).button", "0"); |
115 | 117 |
116 // Numbers out of the unsigned short range. | 118 // Numbers out of the short range. |
117 // 2^{64}-1 | 119 // 2^{64}-1 |
118 shouldBe("new MouseEvent('eventType', { button: 18446744073709551615 }).button",
"0"); | 120 shouldBe("new MouseEvent('eventType', { button: 18446744073709551615 }).button",
"0"); |
119 shouldBe("new MouseEvent('eventType', { button: 12345678901234567890 }).button",
"2048"); | 121 shouldBe("new MouseEvent('eventType', { button: 12345678901234567890 }).button",
"2048"); |
120 shouldBe("new MouseEvent('eventType', { button: 123.45 }).button", "123"); | 122 shouldBe("new MouseEvent('eventType', { button: 123.45 }).button", "123"); |
121 shouldBe("new MouseEvent('eventType', { button: NaN }).button", "0"); | 123 shouldBe("new MouseEvent('eventType', { button: NaN }).button", "0"); |
| 124 shouldBe("new MouseEvent('eventType', { button: 65534 }).button", "-2"); |
| 125 shouldBe("new MouseEvent('eventType', { button: -32769 }).button", "32767"); |
| 126 shouldBe("new MouseEvent('eventType', { button: 32768 }).button", "-32768"); |
| 127 |
122 | 128 |
123 // Non-numeric values. | 129 // Non-numeric values. |
124 shouldBe("new MouseEvent('eventType', { button: undefined }).button", "0"); | 130 shouldBe("new MouseEvent('eventType', { button: undefined }).button", "0"); |
125 shouldBe("new MouseEvent('eventType', { button: null }).button", "0"); | 131 shouldBe("new MouseEvent('eventType', { button: null }).button", "0"); |
126 shouldBe("new MouseEvent('eventType', { button: '' }).button", "0"); | 132 shouldBe("new MouseEvent('eventType', { button: '' }).button", "0"); |
127 shouldBe("new MouseEvent('eventType', { button: '12345' }).button", "12345"); | 133 shouldBe("new MouseEvent('eventType', { button: '12345' }).button", "12345"); |
128 shouldBe("new MouseEvent('eventType', { button: '12345a' }).button", "0"); | 134 shouldBe("new MouseEvent('eventType', { button: '12345a' }).button", "0"); |
129 shouldBe("new MouseEvent('eventType', { button: 'abc' }).button", "0"); | 135 shouldBe("new MouseEvent('eventType', { button: 'abc' }).button", "0"); |
130 shouldBe("new MouseEvent('eventType', { button: [] }).button", "0"); | 136 shouldBe("new MouseEvent('eventType', { button: [] }).button", "0"); |
131 shouldBe("new MouseEvent('eventType', { button: [12345] }).button", "12345"); | 137 shouldBe("new MouseEvent('eventType', { button: [12345] }).button", "12345"); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w
indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl
Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77
7, relatedTarget: testDiv }).clientY", "555"); | 205 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w
indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl
Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77
7, relatedTarget: testDiv }).clientY", "555"); |
200 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w
indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl
Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77
7, relatedTarget: testDiv }).ctrlKey", "true"); | 206 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w
indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl
Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77
7, relatedTarget: testDiv }).ctrlKey", "true"); |
201 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w
indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl
Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77
7, relatedTarget: testDiv }).shiftKey", "true"); | 207 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w
indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl
Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77
7, relatedTarget: testDiv }).shiftKey", "true"); |
202 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w
indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl
Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77
7, relatedTarget: testDiv }).altKey", "true"); | 208 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w
indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl
Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77
7, relatedTarget: testDiv }).altKey", "true"); |
203 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w
indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl
Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77
7, relatedTarget: testDiv }).metaKey", "true"); | 209 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w
indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl
Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77
7, relatedTarget: testDiv }).metaKey", "true"); |
204 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w
indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl
Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77
7, relatedTarget: testDiv }).button", "666"); | 210 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w
indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl
Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77
7, relatedTarget: testDiv }).button", "666"); |
205 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w
indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl
Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77
7, relatedTarget: testDiv }).relatedTarget", "testDiv"); | 211 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w
indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl
Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77
7, relatedTarget: testDiv }).relatedTarget", "testDiv"); |
206 </script> | 212 </script> |
207 </body> | 213 </body> |
208 </html> | 214 </html> |
OLD | NEW |