Chromium Code Reviews| 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 var deltaX = 10; | |
| 8 var deltaY = 120; | |
| 9 | |
| 10 var testDiv; | |
| 11 function runTest() { | |
| 12 // Basic checks. | |
| 13 shouldBe('WheelEvent.__proto__', 'MouseEvent'); | |
|
arv (Not doing code reviews)
2013/08/15 14:05:44
Also
shouldBe('WheelEvent.prototype.__proto__', '
do-not-use
2013/08/16 12:02:50
Done.
| |
| 14 shouldBe('WheelEvent.DOM_DELTA_PIXEL', '0x00'); | |
|
arv (Not doing code reviews)
2013/08/15 14:05:44
Can't believe we are adding more numeric constants
do-not-use
2013/08/16 12:02:50
Well, this is not a recent spec. It is just recent
| |
| 15 shouldBe('WheelEvent.DOM_DELTA_LINE', '0x01'); | |
| 16 shouldBe('WheelEvent.DOM_DELTA_PAGE', '0x02'); | |
| 17 | |
| 18 testDiv = document.getElementById('target'); | |
| 19 shouldBeNull('window.onwheel'); | |
| 20 shouldBeNull('document.onwheel'); | |
| 21 shouldBeNull('testDiv.onwheel'); | |
| 22 testDiv.addEventListener('wheel', wheelHandler); | |
| 23 if (window.eventSender) { | |
| 24 eventSender.mouseMoveTo(testDiv.offsetLeft + 5, testDiv.offsetTop + 5); | |
| 25 eventSender.mouseScrollBy(deltaX, deltaY); | |
| 26 } else { | |
| 27 debug("FAIL: This test requires window.eventSender."); | |
| 28 finishJSTest(); | |
| 29 } | |
| 30 } | |
| 31 | |
| 32 var testEvent; | |
| 33 var tickMultiplier = 120; | |
| 34 var expectedDeltaX = deltaX * tickMultiplier; | |
|
arv (Not doing code reviews)
2013/08/15 14:05:44
The main issues historically have been that the de
do-not-use
2013/08/16 12:02:50
Thanks for bringing my attention to this. I checke
arv (Not doing code reviews)
2013/08/16 14:19:26
My testing in different browsers gave me widely di
do-not-use
2013/08/16 15:14:32
Firefox gave you 3? But likely the unit was in num
do-not-use
2013/08/16 17:32:33
I confirm that Firefox uses 100 as multiplier for
| |
| 35 var expectedDeltaY = deltaY * tickMultiplier; | |
| 36 function wheelHandler(e) { | |
| 37 testEvent = e; | |
| 38 shouldBe("testEvent.__proto__", "WheelEvent.prototype"); | |
| 39 shouldBe("testEvent.__proto__.__proto__", "MouseEvent.prototype"); | |
| 40 shouldBe("testEvent.deltaX", "expectedDeltaX"); | |
| 41 shouldBe("testEvent.deltaY", "expectedDeltaY"); | |
| 42 shouldBeUndefined("testEvent.deltaZ"); // Not supported yet. | |
|
arv (Not doing code reviews)
2013/08/15 14:05:44
Would it be better to return 0 here for now? What
do-not-use
2013/08/16 12:02:50
Done.
| |
| 43 shouldBe("testEvent.deltaMode", "WheelEvent.DOM_DELTA_PIXEL") | |
| 44 | |
| 45 testDiv.removeEventListener("wheel", wheelHandler); | |
| 46 finishJSTest(); | |
| 47 } | |
| 48 | |
| 49 </script> | |
| 50 </head> | |
| 51 <body> | |
| 52 <span id="parent"> | |
| 53 <div id="target" style="border:solid 1px green; width:220px; height:70px; ov erflow:scroll"> | |
| 54 TOP TOP TOP TOP TOP TOP TOP | |
| 55 Scroll mouse wheel over here | |
| 56 Scroll mouse wheel over here | |
| 57 Scroll mouse wheel over here | |
| 58 Scroll mouse wheel over here | |
| 59 Scroll mouse wheel over here | |
| 60 Scroll mouse wheel over here | |
| 61 END END END END END END END | |
| 62 </div> | |
| 63 </span> | |
| 64 <script> | |
| 65 description("Tests the basic functionality of the standard wheel event"); | |
| 66 window.jsTestIsAsync = true; | |
| 67 | |
| 68 runTest(); | |
| 69 </script> | |
| 70 <script src="../js/resources/js-test-post.js"></script> | |
| 71 </body> | |
| 72 </html> | |
| OLD | NEW |