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

Side by Side 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: Take feedback into consideration 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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');
14 shouldBe('WheelEvent.prototype.__proto__', 'MouseEvent.prototype');
15 shouldBe('WheelEvent.DOM_DELTA_PIXEL', '0x00');
16 shouldBe('WheelEvent.DOM_DELTA_LINE', '0x01');
17 shouldBe('WheelEvent.DOM_DELTA_PAGE', '0x02');
18
19 testDiv = document.getElementById('target');
20 shouldBeNull('window.onwheel');
21 shouldBeNull('document.onwheel');
22 shouldBeNull('testDiv.onwheel');
23 testDiv.addEventListener('wheel', wheelHandler);
24 if (window.eventSender) {
25 eventSender.mouseMoveTo(testDiv.offsetLeft + 5, testDiv.offsetTop + 5);
26 eventSender.mouseScrollBy(deltaX, deltaY);
27 } else {
28 debug("FAIL: This test requires window.eventSender.");
29 finishJSTest();
30 }
31 }
32
33 var testEvent;
34 var tickMultiplier = 100;
35 var expectedDeltaX = deltaX * tickMultiplier;
36 var expectedDeltaY = deltaY * tickMultiplier;
37 function wheelHandler(e) {
38 testEvent = e;
39 shouldBe("testEvent.__proto__", "WheelEvent.prototype");
40 shouldBe("testEvent.__proto__.__proto__", "MouseEvent.prototype");
41 shouldBe("testEvent.deltaX", "expectedDeltaX");
42 shouldBe("testEvent.deltaY", "expectedDeltaY");
43 shouldBe("testEvent.deltaZ", "0");
44 shouldBe("testEvent.deltaMode", "WheelEvent.DOM_DELTA_PIXEL")
45
46 testDiv.removeEventListener("wheel", wheelHandler);
47 finishJSTest();
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">
55 TOP TOP TOP TOP TOP TOP TOP
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 Scroll mouse wheel over here
62 END END END END END END END
63 </div>
64 </span>
65 <script>
66 description("Tests the basic functionality of the standard wheel event");
67 window.jsTestIsAsync = true;
68
69 runTest();
70 </script>
71 <script src="../js/resources/js-test-post.js"></script>
72 </body>
73 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698