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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 shouldThrow("new WheelEvent('eventType', { view: 'chocolate' }).view"); | 55 shouldThrow("new WheelEvent('eventType', { view: 'chocolate' }).view"); |
56 shouldThrow("new WheelEvent('eventType', { view: 12345 }).view"); | 56 shouldThrow("new WheelEvent('eventType', { view: 12345 }).view"); |
57 shouldThrow("new WheelEvent('eventType', { view: 18446744073709551615 }).view"); | 57 shouldThrow("new WheelEvent('eventType', { view: 18446744073709551615 }).view"); |
58 shouldThrow("new WheelEvent('eventType', { view: NaN }).view"); | 58 shouldThrow("new WheelEvent('eventType', { view: NaN }).view"); |
59 // Note that valueOf() is not called, when the left hand side is evaluated. | 59 // Note that valueOf() is not called, when the left hand side is evaluated. |
60 shouldThrow("new WheelEvent('eventType', { view: {valueOf: function () { return
window; } } }).view == window"); | 60 shouldThrow("new WheelEvent('eventType', { view: {valueOf: function () { return
window; } } }).view == window"); |
61 shouldBe("new WheelEvent('eventType', { get view() { return window; } }).view",
"window"); | 61 shouldBe("new WheelEvent('eventType', { get view() { return window; } }).view",
"window"); |
62 shouldThrow("new WheelEvent('eventType', { get view() { return 123; } }).view"); | 62 shouldThrow("new WheelEvent('eventType', { get view() { return 123; } }).view"); |
63 shouldThrow("new WheelEvent('eventType', { get view() { throw 'WheelEvent Error'
; } })"); | 63 shouldThrow("new WheelEvent('eventType', { get view() { throw 'WheelEvent Error'
; } })"); |
64 | 64 |
| 65 // detail is passed. |
| 66 // numbers within the long range. |
| 67 shouldBe("new WheelEvent('eventType', { detail: 0 }).detail", "0"); |
| 68 shouldBe("new WheelEvent('eventType', { detail: 2147483647 }).detail", "21474836
47"); |
| 69 shouldBe("new WheelEvent('eventType', { detail: -1 }).detail", "-1"); |
| 70 shouldBe("new WheelEvent('eventType', { detail: -2147483648 }).detail", "-214748
3648"); |
| 71 // numbers out of the long range. |
| 72 shouldBe("new WheelEvent('eventType', { detail: 4294967295 }).detail", "-1"); |
| 73 // 2^{53}-1, the largest number that can be exactly represented by double. |
| 74 shouldBe("new WheelEvent('eventType', { detail: 9007199254740991 }).detail", "-1
"); |
| 75 // 2^{64}-1 |
| 76 shouldBe("new WheelEvent('eventType', { detail: 18446744073709551615 }).detail",
"0"); |
| 77 shouldBe("new WheelEvent('eventType', { detail: 123.45 }).detail", "123"); |
| 78 shouldBe("new WheelEvent('eventType', { detail: NaN }).detail", "0"); |
| 79 // Non-numeric values. |
| 80 shouldBe("new WheelEvent('eventType', { detail: undefined }).detail", "0"); |
| 81 shouldBe("new WheelEvent('eventType', { detail: null }).detail", "0"); |
| 82 shouldBe("new WheelEvent('eventType', { detail: '' }).detail", "0"); |
| 83 shouldBe("new WheelEvent('eventType', { detail: '12345' }).detail", "12345"); |
| 84 shouldBe("new WheelEvent('eventType', { detail: '12345a' }).detail", "0"); |
| 85 shouldBe("new WheelEvent('eventType', { detail: 'abc' }).detail", "0"); |
| 86 shouldBe("new WheelEvent('eventType', { detail: [] }).detail", "0"); |
| 87 shouldBe("new WheelEvent('eventType', { detail: [12345] }).detail", "12345"); |
| 88 shouldBe("new WheelEvent('eventType', { detail: [12345, 67890] }).detail", "0"); |
| 89 shouldBe("new WheelEvent('eventType', { detail: {} }).detail", "0"); |
| 90 shouldBe("new WheelEvent('eventType', { detail: {moemoe: 12345} }).detail", "0")
; |
| 91 shouldBe("new WheelEvent('eventType', { detail: {valueOf: function () { return 1
2345; }} }).detail", "12345"); |
| 92 |
65 // Max/min for client positions (LayoutUnit max/min). | 93 // Max/min for client positions (LayoutUnit max/min). |
66 var MAX_CLIENT_SIZE = "33554431"; | 94 var MAX_CLIENT_SIZE = "33554431"; |
67 var MIN_CLIENT_SIZE = "-33554432"; | 95 var MIN_CLIENT_SIZE = "-33554432"; |
68 | 96 |
69 // detail, screenX, screenY, clientX, clientY, wheelDeltaX and wheelDeltaY are p
assed. | 97 // screenX, screenY, clientX and clientY are passed. |
70 ["detail", "screenX", "screenY", "clientX", "clientY", "wheelDeltaX", "wheelDelt
aY"].forEach(function (attr) { | 98 ["screenX", "screenY", "clientX", "clientY"].forEach(function (attr) { |
| 99 // numbers within the long range. |
| 100 shouldBe("new WheelEvent('eventType', { " + attr + ": 0 })." + attr, "0"); |
| 101 shouldBe("new WheelEvent('eventType', { " + attr + ": 2147483647 })." + attr
, MAX_CLIENT_SIZE); |
| 102 shouldBe("new WheelEvent('eventType', { " + attr + ": -1 })." + attr, "-1"); |
| 103 shouldBe("new WheelEvent('eventType', { " + attr + ": -2147483648 })." + att
r, MIN_CLIENT_SIZE); |
| 104 |
| 105 // numbers out of the long range. |
| 106 shouldBe("new WheelEvent('eventType', { " + attr + ": 4294967295 })." + attr
, MAX_CLIENT_SIZE); |
| 107 // 2^{53}-1, the largest number that can be exactly represented by double. |
| 108 shouldBe("new WheelEvent('eventType', { " + attr + ": 9007199254740991 })."
+ attr, MAX_CLIENT_SIZE); |
| 109 // 2^{64}-1 |
| 110 shouldBe("new WheelEvent('eventType', { " + attr + ": 18446744073709551615 }
)." + attr, MAX_CLIENT_SIZE); |
| 111 shouldBe("new WheelEvent('eventType', { " + attr + ": 123.45 })." + attr, "1
23"); |
| 112 shouldThrow("new WheelEvent('eventType', { " + attr + ": NaN })." + attr); |
| 113 |
| 114 // Non-numeric values. |
| 115 shouldBe("new WheelEvent('eventType', { " + attr + ": undefined })." + attr,
"0"); |
| 116 shouldBe("new WheelEvent('eventType', { " + attr + ": null })." + attr, "0")
; |
| 117 shouldBe("new WheelEvent('eventType', { " + attr + ": '' })." + attr, "0"); |
| 118 shouldBe("new WheelEvent('eventType', { " + attr + ": '12345' })." + attr, "
12345"); |
| 119 shouldThrow("new WheelEvent('eventType', { " + attr + ": '12345a' })." + att
r); |
| 120 shouldThrow("new WheelEvent('eventType', { " + attr + ": 'abc' })." + attr); |
| 121 shouldBe("new WheelEvent('eventType', { " + attr + ": [] })." + attr, "0"); |
| 122 shouldBe("new WheelEvent('eventType', { " + attr + ": [12345] })." + attr, "
12345"); |
| 123 shouldThrow("new WheelEvent('eventType', { " + attr + ": [12345, 67890] })."
+ attr); |
| 124 shouldThrow("new WheelEvent('eventType', { " + attr + ": {} })." + attr); |
| 125 shouldThrow("new WheelEvent('eventType', { " + attr + ": {moemoe: 12345} }).
" + attr); |
| 126 shouldBe("new WheelEvent('eventType', { " + attr + ": {valueOf: function ()
{ return 12345; }} })." + attr, "12345"); |
| 127 }); |
| 128 |
| 129 // wheelDeltaX and wheelDeltaY are passed. |
| 130 ["wheelDeltaX", "wheelDeltaY"].forEach(function (attr) { |
71 // numbers within the long range. | 131 // numbers within the long range. |
72 shouldBe("new WheelEvent('eventType', { " + attr + ": 0 })." + attr, "0"); | 132 shouldBe("new WheelEvent('eventType', { " + attr + ": 0 })." + attr, "0"); |
73 shouldBe("new WheelEvent('eventType', { " + attr + ": 2147483647 })." + attr
, attr == "clientX" || attr == "clientY" ? MAX_CLIENT_SIZE : "2147483647"); | 133 shouldBe("new WheelEvent('eventType', { " + attr + ": 2147483647 })." + attr
, attr == "clientX" || attr == "clientY" ? MAX_CLIENT_SIZE : "2147483647"); |
74 shouldBe("new WheelEvent('eventType', { " + attr + ": -1 })." + attr, "-1"); | 134 shouldBe("new WheelEvent('eventType', { " + attr + ": -1 })." + attr, "-1"); |
75 shouldBe("new WheelEvent('eventType', { " + attr + ": -2147483648 })." + att
r, attr == "clientX" || attr == "clientY" ? MIN_CLIENT_SIZE : "-2147483648"); | 135 shouldBe("new WheelEvent('eventType', { " + attr + ": -2147483648 })." + att
r, attr == "clientX" || attr == "clientY" ? MIN_CLIENT_SIZE : "-2147483648"); |
76 | 136 |
77 // numbers out of the long range. | 137 // numbers out of the long range. |
78 shouldBe("new WheelEvent('eventType', { " + attr + ": 4294967295 })." + attr
, "-1"); | 138 shouldBe("new WheelEvent('eventType', { " + attr + ": 4294967295 })." + attr
, "-1"); |
79 // 2^{53}-1, the largest number that can be exactly represented by double. | 139 // 2^{53}-1, the largest number that can be exactly represented by double. |
80 shouldBe("new WheelEvent('eventType', { " + attr + ": 9007199254740991 })."
+ attr, "-1"); | 140 shouldBe("new WheelEvent('eventType', { " + attr + ": 9007199254740991 })."
+ attr, "-1"); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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"); | 304 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"); |
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"); | 305 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"); |
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"); | 306 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"); |
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"); | 307 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"); |
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"); | 308 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"); |
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"); | 309 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"); |
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"); | 310 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"); |
251 </script> | 311 </script> |
252 </body> | 312 </body> |
253 </html> | 313 </html> |
OLD | NEW |