Index: LayoutTests/fast/events/wheelevent-basic.html |
diff --git a/LayoutTests/fast/events/wheelevent-basic.html b/LayoutTests/fast/events/wheelevent-basic.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3c6324a03c03a249d0002143718c95c9ebe43ffe |
--- /dev/null |
+++ b/LayoutTests/fast/events/wheelevent-basic.html |
@@ -0,0 +1,72 @@ |
+<!DOCTYPE html> |
+<html> |
+<head> |
+<link rel="help" href="http://www.w3.org/TR/DOM-Level-3-Events/#events-WheelEvent"> |
+<script src="../js/resources/js-test-pre.js"></script> |
+<script> |
+var deltaX = 10; |
+var deltaY = 120; |
+ |
+var testDiv; |
+function runTest() { |
+ // Basic checks. |
+ 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.
|
+ 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
|
+ shouldBe('WheelEvent.DOM_DELTA_LINE', '0x01'); |
+ shouldBe('WheelEvent.DOM_DELTA_PAGE', '0x02'); |
+ |
+ testDiv = document.getElementById('target'); |
+ shouldBeNull('window.onwheel'); |
+ shouldBeNull('document.onwheel'); |
+ shouldBeNull('testDiv.onwheel'); |
+ testDiv.addEventListener('wheel', wheelHandler); |
+ if (window.eventSender) { |
+ eventSender.mouseMoveTo(testDiv.offsetLeft + 5, testDiv.offsetTop + 5); |
+ eventSender.mouseScrollBy(deltaX, deltaY); |
+ } else { |
+ debug("FAIL: This test requires window.eventSender."); |
+ finishJSTest(); |
+ } |
+} |
+ |
+var testEvent; |
+var tickMultiplier = 120; |
+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
|
+var expectedDeltaY = deltaY * tickMultiplier; |
+function wheelHandler(e) { |
+ testEvent = e; |
+ shouldBe("testEvent.__proto__", "WheelEvent.prototype"); |
+ shouldBe("testEvent.__proto__.__proto__", "MouseEvent.prototype"); |
+ shouldBe("testEvent.deltaX", "expectedDeltaX"); |
+ shouldBe("testEvent.deltaY", "expectedDeltaY"); |
+ 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.
|
+ shouldBe("testEvent.deltaMode", "WheelEvent.DOM_DELTA_PIXEL") |
+ |
+ testDiv.removeEventListener("wheel", wheelHandler); |
+ finishJSTest(); |
+} |
+ |
+</script> |
+</head> |
+<body> |
+<span id="parent"> |
+ <div id="target" style="border:solid 1px green; width:220px; height:70px; overflow:scroll"> |
+ TOP TOP TOP TOP TOP TOP TOP |
+ Scroll mouse wheel over here |
+ Scroll mouse wheel over here |
+ Scroll mouse wheel over here |
+ Scroll mouse wheel over here |
+ Scroll mouse wheel over here |
+ Scroll mouse wheel over here |
+ END END END END END END END |
+ </div> |
+</span> |
+<script> |
+description("Tests the basic functionality of the standard wheel event"); |
+window.jsTestIsAsync = true; |
+ |
+runTest(); |
+</script> |
+<script src="../js/resources/js-test-post.js"></script> |
+</body> |
+</html> |