Skip to content

Commit 796e339

Browse files
liviutintachromium-wpt-export-bot
authored andcommitted
PointerEvent WPT for compat mouse events: fix timeout in FF and Safari
Different browsers fire different number of events for this test. Stop the test when the done button is clicked instead of when a certain number of events are fired. There are significant differences in how browsers fire pointer events and compatible mouse events when an element is removed from the DOM. There is a discussion here: w3c/pointerevents#285 about the order of pointerenter events and compatible mouseenter events when an element is removed from the DOM. Once the discussion is finalized and there is consensus this test might have to be adjusted. Change-Id: I5202eb7a1fcc557985279a978596c9446105f417 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2348530 Commit-Queue: Liviu Tinta <[email protected]> Reviewed-by: Mustaq Ahmed <[email protected]> Cr-Commit-Position: refs/heads/master@{#796943}
1 parent 55026a9 commit 796e339

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

pointerevents/compat/pointerevent_compat-mouse-events-when-removing-nodes.html

+13-3
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,17 @@
55
<script src="/resources/testdriver-vendor.js"></script>
66
<script src="/resources/testdriver-actions.js"></script>
77
<script type="text/javascript" src="../pointerevent_support.js"></script>
8-
8+
<!-- There are significant differences in how browsers fire pointer events and
9+
compat mouse events when elements are removed from the dom.
10+
There is a discussion about the order of pointer events and mouse compat events
11+
for this scenario in the pointer event working group (See link below)-->
12+
<link rel="help" href="https://github.com/w3c/pointerevents/issues/285">
913
<style>
1014
div.box {
1115
margin: 5px;
1216
padding: 20px;
1317
float: left;
18+
background-color:green;
1419
}
1520
#grey {
1621
width: 50px;
@@ -22,12 +27,14 @@ <h1>Verifies the compatibility mouse events are sent correctly when the node is
2227

2328
<div id="grey" class="box" style="background-color:grey">
2429
</div>
30+
<button id="done">Done</button>
2531

2632
<div id="console"></div>
2733

2834
<script>
2935

3036
var receivedEvents = [];
37+
var done_clicked = false;
3138

3239
var eventList = ["mousedown", "mouseup", "mousemove",
3340
"pointerdown", "pointerup", "pointermove"];
@@ -62,6 +69,9 @@ <h1>Verifies the compatibility mouse events are sent correctly when the node is
6269
});
6370
}
6471

72+
var done_button = document.getElementById("done");
73+
done_button.addEventListener("click",()=>done_clicked=true);
74+
6575
function performActions() {
6676
var rect = document.getElementById("green").getBoundingClientRect();
6777
var x1 = Math.ceil(rect.left + 5);
@@ -73,13 +83,13 @@ <h1>Verifies the compatibility mouse events are sent correctly when the node is
7383
.pointerDown()
7484
.pointerUp()
7585
.send()
76-
.then( () => resolveWhen( () => receivedEvents.length == 6 ) );
86+
.then(()=> test_driver.click(done_button));
7787
}
7888

7989
function testScenario(targetEvent, expectedEvents, description) {
8090
promise_test(async () => {
81-
removeNodeEvent = targetEvent;
8291
receivedEvents = [];
92+
removeNodeEvent = targetEvent;
8393
createGreenBoxAndAddListeners();
8494

8595
await performActions();

0 commit comments

Comments
 (0)