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="../js/resources/js-test-pre.js"></script> |
| 6 <script> |
| 7 function runTest() { |
| 8 var div = document.getElementById('target'); |
| 9 div.addEventListener('wheel', wheelHandler); |
| 10 div.addEventListener('mousewheel', mouseWheelHandler); |
| 11 if (window.eventSender) { |
| 12 eventSender.mouseMoveTo(div.offsetLeft + 5, div.offsetTop + 5); |
| 13 eventSender.mouseScrollBy(10, 20); |
| 14 finishJSTest(); |
| 15 } else { |
| 16 debug("FAIL: This test requires window.eventSender."); |
| 17 finishJSTest(); |
| 18 } |
| 19 } |
| 20 |
| 21 var testEvent; |
| 22 function wheelHandler(e) { |
| 23 testEvent = e; |
| 24 testPassed("Standard wheel event was fired."); |
| 25 shouldBe("testEvent.__proto__", "WheelEvent.prototype"); |
| 26 } |
| 27 |
| 28 function mouseWheelHandler(e) { |
| 29 testFailed("mousewheel event should not have fired."); |
| 30 } |
| 31 |
| 32 </script> |
| 33 </head> |
| 34 <body> |
| 35 <span id="parent"> |
| 36 <div id="target" style="border:solid 1px green; width:220px; height:70px; ov
erflow:scroll"> |
| 37 TOP TOP TOP TOP TOP TOP TOP |
| 38 Scroll mouse wheel over here |
| 39 Scroll mouse wheel over here |
| 40 Scroll mouse wheel over here |
| 41 Scroll mouse wheel over here |
| 42 Scroll mouse wheel over here |
| 43 Scroll mouse wheel over here |
| 44 END END END END END END END |
| 45 </div> |
| 46 </span> |
| 47 <script> |
| 48 description("Tests the interaction between the standard 'wheel' event and the no
n-standard 'mousewheel' one"); |
| 49 window.jsTestIsAsync = true; |
| 50 |
| 51 runTest(); |
| 52 </script> |
| 53 <script src="../js/resources/js-test-post.js"></script> |
| 54 </body> |
| 55 </html> |
OLD | NEW |