4 <script src=
"../../resources/js-test.js"></script>
6 window
.jsTestIsAsync
= true;
8 function initEventHandlers(element
) {
9 element
.addEventListener('mousedown', handleEvent
);
10 element
.addEventListener('mouseup', handleEvent
);
11 element
.addEventListener('click', handleEvent
);
15 function handleEvent(e
) {
16 window
.events
.push(e
);
20 shouldBe("events.length", "4");
21 shouldBeEqualToString("events[0].type", "mousedown");
22 shouldBeEqualToString("events[0].target.id", "scrollme");
23 shouldBe("events[0].which", "1");
24 shouldBeEqualToString("events[1].type", "mouseup");
25 shouldBeEqualToString("events[1].target.id", "scrollme");
26 shouldBe("events[1].which", "1");
27 shouldBeEqualToString("events[2].type", "mousedown");
28 shouldBeEqualToString("events[2].target.id", "scrollme");
29 shouldBe("events[2].which", "2");
30 shouldBeEqualToString("events[3].type", "mouseup");
31 shouldBeEqualToString("events[3].target.id", "scrollme");
32 shouldBe("events[3].which", "2");
36 window
.onload = function () {
37 var d
= document
.querySelector('#scrollme');
40 if (window
.eventSender
) {
41 eventSender
.mouseMoveTo(d
.offsetLeft
+ d
.offsetWidth
- 4, d
.offsetTop
+ 4);
42 eventSender
.mouseDown();
43 eventSender
.mouseUp();
44 eventSender
.mouseDown(1);
45 eventSender
.mouseUp(1);
48 debug('This test requires eventSender. Click the scrollbar to play manually.');
63 <div id=
"scrollme"><p>This is a scrollable div.
</p></div>
64 <pre id=
"console"></pre>