| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 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> | |
| 6 <script> | |
| 7 window.jsTestIsAsync = true; | |
| 8 | |
| 9 var deltaX = 0; | |
| 10 var deltaY = 0; | |
| 11 | |
| 12 var testDiv; | |
| 13 function runTest() { | |
| 14 // Basic checks. | |
| 15 shouldBe('WheelEvent.__proto__', 'MouseEvent'); | |
| 16 shouldBe('WheelEvent.prototype.__proto__', 'MouseEvent.prototype'); | |
| 17 shouldBe('WheelEvent.DOM_DELTA_PIXEL', '0x00'); | |
| 18 shouldBe('WheelEvent.DOM_DELTA_LINE', '0x01'); | |
| 19 shouldBe('WheelEvent.DOM_DELTA_PAGE', '0x02'); | |
| 20 | |
| 21 testDiv = document.getElementById('target'); | |
| 22 shouldBeNull('window.onwheel'); | |
| 23 shouldBeNull('document.onwheel'); | |
| 24 shouldBeNull('testDiv.onwheel'); | |
| 25 testDiv.addEventListener('wheel', wheelHandler); | |
| 26 if (window.eventSender) { | |
| 27 eventSender.mouseMoveTo(testDiv.offsetLeft + 5, testDiv.offsetTop + 5); | |
| 28 eventSender.mouseScrollBy(-1, -2); | |
| 29 var positive = "deltaX > 0 && deltaY > 0"; | |
| 30 var correct = "deltaX == testDiv.scrollLeft && deltaY == testDiv.scrollT
op"; | |
| 31 shouldBecomeEqual(positive + " && " + correct , "true", finishJSTest); | |
| 32 } else { | |
| 33 debug("FAIL: This test requires window.eventSender."); | |
| 34 } | |
| 35 } | |
| 36 | |
| 37 var testEvent; | |
| 38 function wheelHandler(e) { | |
| 39 testEvent = e; | |
| 40 shouldBe("testEvent.__proto__", "WheelEvent.prototype"); | |
| 41 shouldBe("testEvent.__proto__.__proto__", "MouseEvent.prototype"); | |
| 42 if (e.deltaX) | |
| 43 deltaX = e.deltaX; | |
| 44 if (e.deltaY) | |
| 45 deltaY = e.deltaY; | |
| 46 shouldBe("testEvent.deltaZ", "0"); | |
| 47 shouldBe("testEvent.deltaMode", "WheelEvent.DOM_DELTA_PIXEL") | |
| 48 } | |
| 49 | |
| 50 </script> | |
| 51 </head> | |
| 52 <body> | |
| 53 <span id="parent"> | |
| 54 <div id="target" style="border:solid 1px green; width:220px; height:70px; ov
erflow:scroll; white-space:nowrap;"> | |
| 55 TOP TOP TOP TOP TOP TOP TOP TOP TOP TOP TOP TOP TOP TOP<br/> | |
| 56 Scroll mouse wheel over here<br/> | |
| 57 Scroll mouse wheel over here<br/> | |
| 58 Scroll mouse wheel over here<br/> | |
| 59 Scroll mouse wheel over here<br/> | |
| 60 Scroll mouse wheel over here<br/> | |
| 61 Scroll mouse wheel over here<br/> | |
| 62 END END END END END END END END END END END END END END<br/> | |
| 63 </div> | |
| 64 </span> | |
| 65 <div id="console"></div> | |
| 66 <script> | |
| 67 description("Tests the basic functionality of the standard wheel event"); | |
| 68 | |
| 69 runTest(); | |
| 70 </script> | |
| 71 </body> | |
| 72 </html> | |
| OLD | NEW |