5 <title>mousemove event: preventDefault()
</title>
6 <link rel=
"author" title=
"Mirko Brodesser" href=
"mailto:mbrodesser@mozilla.com">
7 <link rel=
"help" href=
"https://github.com/w3c/uievents/issues/278">
8 <script src=/resources/testharness.js
></script>
9 <script src=/resources/testharnessreport.js
></script>
10 <script src=/uievents/resources/eventrecorder.js
></script>
11 <script src=/resources/testdriver.js
></script>
12 <script src=/resources/testdriver-actions.js
></script>
13 <script src=/resources/testdriver-vendor.js
></script>
22 const eventsToRecord
= [
28 const expectedEventRecords
= [
29 {type
: "mousemove", target
: "a"},
30 {type
: "mousemove", target
: "document"},
31 {type
: "mousedown", target
: "a"},
32 {type
: "mousedown", target
: "document"},
33 {type
: "selectionchange", target
: "document"},
34 {type
: "mousemove", target
: "b"},
35 {type
: "mousemove", target
: "document"},
38 window
.onload = function () {
39 setup({single_test
: true});
41 const a
= document
.getElementById("a");
42 const b
= document
.getElementById("b");
43 const nodesToListenForEvents
= [a
, b
, document
];
45 EventRecorder
.configure({
49 "document" : document
,
53 EventRecorder
.addEventListenersForNodes(eventsToRecord
,
54 nodesToListenForEvents
, null);
56 document
.addEventListener("mousemove", (event
) => {
57 event
.preventDefault();
60 EventRecorder
.start();
62 let actions_promise
= new test_driver
.Actions()
63 .pointerMove(0, 0, {origin
: a
})
67 actions_promise
.then(() => {
68 window
.requestAnimationFrame(() => {
69 window
.requestAnimationFrame(() => {
70 // Requested two animation frames to enforce flushing the
71 // "selectionchange" event.
76 actions_promise
= new test_driver
.Actions()
77 .pointerMove(0, 0, {origin
: b
})
80 actions_promise
.then(() => {
81 window
.requestAnimationFrame(() => {
82 window
.requestAnimationFrame(() => {
83 // Requested two animation frames to enforce flusing the
84 // "selectionchange" event, if there was one.
87 assert_true(EventRecorder
.checkRecords(expectedEventRecords
),
88 "Events are as expected");