Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(501)

Unified Diff: LayoutTests/fast/events/wheelevent-basic.html

Issue 22859012: Add support for DOM Level 3 WheelEvent (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rename prefixedType() to legacyType() Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/events/wheelevent-basic-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..96ea38d276f4d9944594d539456975fe9a8f5c1d
--- /dev/null
+++ b/LayoutTests/fast/events/wheelevent-basic.html
@@ -0,0 +1,73 @@
+<!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');
+ shouldBe('WheelEvent.prototype.__proto__', 'MouseEvent.prototype');
+ shouldBe('WheelEvent.DOM_DELTA_PIXEL', '0x00');
+ 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;
+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");
+ shouldBe("testEvent.deltaZ", "0");
+ 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>
« no previous file with comments | « no previous file | LayoutTests/fast/events/wheelevent-basic-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698