OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <link rel="help" href="http://www.w3.org/TR/DOM-Level-3-Events/#events-WheelEven
t"> | 4 <link rel="help" href="http://www.w3.org/TR/DOM-Level-3-Events/#events-WheelEven
t"> |
5 <script src="../../../resources/js-test.js"></script> | 5 <script src="../../../resources/js-test.js"></script> |
6 <script> | 6 <script> |
7 window.jsTestIsAsync = true; | 7 window.jsTestIsAsync = true; |
8 | 8 |
9 var deltaX = 0; | 9 var deltaX = 0; |
10 var deltaY = 0; | 10 var deltaY = 0; |
11 | 11 |
12 var testDiv; | 12 var testDiv; |
13 function runTest() { | 13 function runTest() { |
14 // Basic checks. | 14 // Basic checks. |
15 shouldBe('WheelEvent.__proto__', 'MouseEvent'); | 15 shouldBe('WheelEvent.__proto__', 'MouseEvent'); |
16 shouldBe('WheelEvent.prototype.__proto__', 'MouseEvent.prototype'); | 16 shouldBe('WheelEvent.prototype.__proto__', 'MouseEvent.prototype'); |
17 shouldBe('WheelEvent.DOM_DELTA_PIXEL', '0x00'); | 17 shouldBe('WheelEvent.DOM_DELTA_PIXEL', '0x00'); |
18 shouldBe('WheelEvent.DOM_DELTA_LINE', '0x01'); | 18 shouldBe('WheelEvent.DOM_DELTA_LINE', '0x01'); |
19 shouldBe('WheelEvent.DOM_DELTA_PAGE', '0x02'); | 19 shouldBe('WheelEvent.DOM_DELTA_PAGE', '0x02'); |
20 | 20 |
21 testDiv = document.getElementById('target'); | 21 testDiv = document.getElementById('target'); |
22 shouldBeNull('window.onwheel'); | 22 shouldBeNull('window.onwheel'); |
23 shouldBeNull('document.onwheel'); | 23 shouldBeNull('document.onwheel'); |
24 shouldBeNull('testDiv.onwheel'); | 24 shouldBeNull('testDiv.onwheel'); |
25 testDiv.addEventListener('wheel', wheelHandler); | 25 testDiv.addEventListener('wheel', wheelHandler); |
26 if (window.eventSender) { | 26 if (window.eventSender) { |
27 eventSender.mouseMoveTo(testDiv.offsetLeft + 5, testDiv.offsetTop + 5); | 27 eventSender.mouseMoveTo(testDiv.offsetLeft + 5, testDiv.offsetTop + 5); |
28 eventSender.mouseScrollBy(-1, -2); | 28 eventSender.mouseScrollBy(-1, -2, false, false, 0, true, 'phaseBegan'); |
29 var positive = "deltaX > 0 && deltaY > 0"; | 29 var positive = "deltaX > 0 && deltaY > 0"; |
30 var correct = "deltaX == testDiv.scrollLeft && deltaY == testDiv.scrollT
op"; | 30 var correct = "deltaX == testDiv.scrollLeft && deltaY == testDiv.scrollT
op"; |
31 shouldBecomeEqual(positive + " && " + correct , "true", finishJSTest); | 31 shouldBecomeEqual(positive + " && " + correct , "true", finishJSTest); |
32 } else { | 32 } else { |
33 debug("FAIL: This test requires window.eventSender."); | 33 debug("FAIL: This test requires window.eventSender."); |
34 } | 34 } |
35 } | 35 } |
36 | 36 |
37 var testEvent; | 37 var testEvent; |
38 function wheelHandler(e) { | 38 function wheelHandler(e) { |
(...skipping 24 matching lines...) Expand all Loading... |
63 </div> | 63 </div> |
64 </span> | 64 </span> |
65 <div id="console"></div> | 65 <div id="console"></div> |
66 <script> | 66 <script> |
67 description("Tests the basic functionality of the standard wheel event"); | 67 description("Tests the basic functionality of the standard wheel event"); |
68 | 68 |
69 runTest(); | 69 runTest(); |
70 </script> | 70 </script> |
71 </body> | 71 </body> |
72 </html> | 72 </html> |
OLD | NEW |