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 WheelEvent DOM class."); | 9 description("This tests the constructor for the WheelEvent DOM class."); |
10 | 10 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 shouldBe("new WheelEvent('eventType', { deltaMode: {moemoe: 12345} }).deltaMode"
, "0"); | 163 shouldBe("new WheelEvent('eventType', { deltaMode: {moemoe: 12345} }).deltaMode"
, "0"); |
164 shouldBe("new WheelEvent('eventType', { deltaMode: {valueOf: function () { retur
n 12345; }} }).deltaMode", "12345"); | 164 shouldBe("new WheelEvent('eventType', { deltaMode: {valueOf: function () { retur
n 12345; }} }).deltaMode", "12345"); |
165 | 165 |
166 // ctrlKey, altKey, shiftKey and metaKey are passed. | 166 // ctrlKey, altKey, shiftKey and metaKey are passed. |
167 ["ctrlKey", "altKey", "shiftKey", "metaKey"].forEach(function (attr) { | 167 ["ctrlKey", "altKey", "shiftKey", "metaKey"].forEach(function (attr) { |
168 shouldBe("new WheelEvent('eventType', { " + attr + ": false })." + attr, "fa
lse"); | 168 shouldBe("new WheelEvent('eventType', { " + attr + ": false })." + attr, "fa
lse"); |
169 shouldBe("new WheelEvent('eventType', { " + attr + ": true })." + attr, "tru
e"); | 169 shouldBe("new WheelEvent('eventType', { " + attr + ": true })." + attr, "tru
e"); |
170 }); | 170 }); |
171 | 171 |
172 // button is passed. | 172 // button is passed. |
173 // Numbers within the unsigned short range. | 173 // Numbers within the short range. |
174 shouldBe("new WheelEvent('eventType', { button: 0 }).button", "0"); | 174 shouldBe("new WheelEvent('eventType', { button: 0 }).button", "0"); |
175 shouldBe("new WheelEvent('eventType', { button: 1 }).button", "1"); | 175 shouldBe("new WheelEvent('eventType', { button: 1 }).button", "1"); |
176 shouldBe("new WheelEvent('eventType', { button: 65534 }).button", "65534"); | 176 shouldBe("new WheelEvent('eventType', { button: -2 }).button", "-2"); |
| 177 shouldBe("new WheelEvent('eventType', { button: -32768 }).button", "-32768"); |
| 178 shouldBe("new WheelEvent('eventType', { button: 32767 }).button", "32767"); |
177 | 179 |
178 // Numbers that are equal to ((unsigned short)-1) should be treated as 0. | 180 // Numbers that are equal to -1 should be treated as 0. |
179 shouldBe("new WheelEvent('eventType', { button: 65535 }).button", "0"); | 181 shouldBe("new WheelEvent('eventType', { button: 65535 }).button", "0"); |
180 shouldBe("new WheelEvent('eventType', { button: 9007199254740991 }).button", "0"
); | 182 shouldBe("new WheelEvent('eventType', { button: 9007199254740991 }).button", "0"
); |
181 shouldBe("new WheelEvent('eventType', { button: -1 }).button", "0"); | 183 shouldBe("new WheelEvent('eventType', { button: -1 }).button", "0"); |
182 | 184 |
183 // Numbers out of the unsigned short range. | 185 // Numbers out of the short range. |
184 // 2^{64}-1 | 186 // 2^{64}-1 |
185 shouldBe("new WheelEvent('eventType', { button: 18446744073709551615 }).button",
"0"); | 187 shouldBe("new WheelEvent('eventType', { button: 18446744073709551615 }).button",
"0"); |
186 shouldBe("new WheelEvent('eventType', { button: 12345678901234567890 }).button",
"2048"); | 188 shouldBe("new WheelEvent('eventType', { button: 12345678901234567890 }).button",
"2048"); |
187 shouldBe("new WheelEvent('eventType', { button: 123.45 }).button", "123"); | 189 shouldBe("new WheelEvent('eventType', { button: 123.45 }).button", "123"); |
188 shouldBe("new WheelEvent('eventType', { button: NaN }).button", "0"); | 190 shouldBe("new WheelEvent('eventType', { button: NaN }).button", "0"); |
| 191 shouldBe("new WheelEvent('eventType', { button: 65534 }).button", "-2"); |
| 192 shouldBe("new WheelEvent('eventType', { button: -32769 }).button", "32767"); |
| 193 shouldBe("new WheelEvent('eventType', { button: 32768 }).button", "-32768"); |
| 194 |
189 | 195 |
190 // Non-numeric values. | 196 // Non-numeric values. |
191 shouldBe("new WheelEvent('eventType', { button: undefined }).button", "0"); | 197 shouldBe("new WheelEvent('eventType', { button: undefined }).button", "0"); |
192 shouldBe("new WheelEvent('eventType', { button: null }).button", "0"); | 198 shouldBe("new WheelEvent('eventType', { button: null }).button", "0"); |
193 shouldBe("new WheelEvent('eventType', { button: '' }).button", "0"); | 199 shouldBe("new WheelEvent('eventType', { button: '' }).button", "0"); |
194 shouldBe("new WheelEvent('eventType', { button: '12345' }).button", "12345"); | 200 shouldBe("new WheelEvent('eventType', { button: '12345' }).button", "12345"); |
195 shouldBe("new WheelEvent('eventType', { button: '12345a' }).button", "0"); | 201 shouldBe("new WheelEvent('eventType', { button: '12345a' }).button", "0"); |
196 shouldBe("new WheelEvent('eventType', { button: 'abc' }).button", "0"); | 202 shouldBe("new WheelEvent('eventType', { button: 'abc' }).button", "0"); |
197 shouldBe("new WheelEvent('eventType', { button: [] }).button", "0"); | 203 shouldBe("new WheelEvent('eventType', { button: [] }).button", "0"); |
198 shouldBe("new WheelEvent('eventType', { button: [12345] }).button", "12345"); | 204 shouldBe("new WheelEvent('eventType', { button: [12345] }).button", "12345"); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 shouldBe("new WheelEvent('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, relatedTarg
et: testDiv, wheelDeltaX: 777, wheelDeltaY: 888, deltaMode: WheelEvent.DOM_DELTA
_PAGE }).altKey", "true"); | 244 shouldBe("new WheelEvent('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, relatedTarg
et: testDiv, wheelDeltaX: 777, wheelDeltaY: 888, deltaMode: WheelEvent.DOM_DELTA
_PAGE }).altKey", "true"); |
239 shouldBe("new WheelEvent('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, relatedTarg
et: testDiv, wheelDeltaX: 777, wheelDeltaY: 888, deltaMode: WheelEvent.DOM_DELTA
_PAGE }).metaKey", "true"); | 245 shouldBe("new WheelEvent('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, relatedTarg
et: testDiv, wheelDeltaX: 777, wheelDeltaY: 888, deltaMode: WheelEvent.DOM_DELTA
_PAGE }).metaKey", "true"); |
240 shouldBe("new WheelEvent('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, relatedTarg
et: testDiv, wheelDeltaX: 777, wheelDeltaY: 888, deltaMode: WheelEvent.DOM_DELTA
_PAGE }).button", "666"); | 246 shouldBe("new WheelEvent('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, relatedTarg
et: testDiv, wheelDeltaX: 777, wheelDeltaY: 888, deltaMode: WheelEvent.DOM_DELTA
_PAGE }).button", "666"); |
241 shouldBe("new WheelEvent('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, relatedTarg
et: testDiv, wheelDeltaX: 777, wheelDeltaY: 888, deltaMode: WheelEvent.DOM_DELTA
_PAGE }).relatedTarget", "testDiv"); | 247 shouldBe("new WheelEvent('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, relatedTarg
et: testDiv, wheelDeltaX: 777, wheelDeltaY: 888, deltaMode: WheelEvent.DOM_DELTA
_PAGE }).relatedTarget", "testDiv"); |
242 shouldBe("new WheelEvent('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, relatedTarg
et: testDiv, wheelDeltaX: 777, wheelDeltaY: 888, deltaMode: WheelEvent.DOM_DELTA
_PAGE }).wheelDeltaX", "777"); | 248 shouldBe("new WheelEvent('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, relatedTarg
et: testDiv, wheelDeltaX: 777, wheelDeltaY: 888, deltaMode: WheelEvent.DOM_DELTA
_PAGE }).wheelDeltaX", "777"); |
243 shouldBe("new WheelEvent('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, relatedTarg
et: testDiv, wheelDeltaX: 777, wheelDeltaY: 888, deltaMode: WheelEvent.DOM_DELTA
_PAGE }).wheelDeltaY", "888"); | 249 shouldBe("new WheelEvent('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, relatedTarg
et: testDiv, wheelDeltaX: 777, wheelDeltaY: 888, deltaMode: WheelEvent.DOM_DELTA
_PAGE }).wheelDeltaY", "888"); |
244 shouldBe("new WheelEvent('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, relatedTarg
et: testDiv, wheelDeltaX: 777, wheelDeltaY: 888, deltaMode: WheelEvent.DOM_DELTA
_PAGE }).deltaMode", "WheelEvent.DOM_DELTA_PAGE"); | 250 shouldBe("new WheelEvent('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, relatedTarg
et: testDiv, wheelDeltaX: 777, wheelDeltaY: 888, deltaMode: WheelEvent.DOM_DELTA
_PAGE }).deltaMode", "WheelEvent.DOM_DELTA_PAGE"); |
245 </script> | 251 </script> |
246 </body> | 252 </body> |
247 </html> | 253 </html> |
OLD | NEW |