mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Bug 1804478 [wpt PR 37377] - [Interop] Add a WPT that canceling mousemove doesn't affect drag., a=testonly
Automatic update from web-platform-tests [Interop] Add a WPT that canceling mousemove doesn't affect drag. This is related to https://github.com/w3c/uievents/issues/278. Bug: 346473 Change-Id: I0bc9d732369a0fa5eb8f4a4bcc04c7eabce26e6b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4086261 Reviewed-by: Kevin Ellis <kevers@chromium.org> Commit-Queue: Mustaq Ahmed <mustaq@chromium.org> Cr-Commit-Position: refs/heads/main@{#1080459} -- wpt-commits: 295326a59547f180def6ca57e5794fa68e07939f wpt-pr: 37377
This commit is contained in:
parent
c2cdefcb30
commit
72e4d30e01
@ -13,17 +13,12 @@
|
||||
<body>
|
||||
<div id="a">div a</div>
|
||||
<div id="b">div b</div>
|
||||
<div id="c" draggable="true">div c</div>
|
||||
</body>
|
||||
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
const a = document.getElementById("a");
|
||||
const b = document.getElementById("b");
|
||||
|
||||
const expected_events = ["mousemove", "mousedown", "selectionchange",
|
||||
"mousemove", "selectionchange"];
|
||||
|
||||
let event_log = [];
|
||||
|
||||
function logEvents(e) {
|
||||
@ -32,7 +27,7 @@
|
||||
|
||||
// Deliberately avoiding mouseup here because the last selectionchange
|
||||
// may be fired before or after the mouseup.
|
||||
["mousedown", "mousemove", "selectionchange"].forEach(ename => {
|
||||
["mousedown", "mousemove", "selectionchange", "dragstart"].forEach(ename => {
|
||||
document.addEventListener(ename, logEvents);
|
||||
});
|
||||
document.addEventListener("mousemove", e => e.preventDefault());
|
||||
@ -40,7 +35,10 @@
|
||||
promise_test(async () => {
|
||||
event_log = [];
|
||||
|
||||
let mouseup_promise = getEvent("mouseup", document);
|
||||
const a = document.getElementById("a");
|
||||
const b = document.getElementById("b");
|
||||
|
||||
let mouseup_promise = getEvent("mouseup", document);
|
||||
|
||||
await new test_driver.Actions()
|
||||
.pointerMove(0, 0, {origin: a})
|
||||
@ -55,7 +53,41 @@
|
||||
|
||||
await mouseup_promise;
|
||||
|
||||
const expected_events = ["mousemove", "mousedown", "selectionchange",
|
||||
"mousemove", "selectionchange"];
|
||||
|
||||
assert_equals(event_log.toString(), expected_events.toString(),
|
||||
"received events");
|
||||
}, "selectionchange event firing when mousemove event is prevented");
|
||||
|
||||
promise_test(async () => {
|
||||
event_log = [];
|
||||
|
||||
const b = document.getElementById("b");
|
||||
const c = document.getElementById("c");
|
||||
|
||||
let dragstart_promise = getEvent("dragstart", document);
|
||||
|
||||
// A mouseup event is not expected. This avoids timing out when the
|
||||
// dragstart event is missing.
|
||||
let mouseup_promise = getEvent("mouseup", document);
|
||||
|
||||
await new test_driver.Actions()
|
||||
.pointerMove(0, 0, {origin: c})
|
||||
.pointerDown()
|
||||
.addTick()
|
||||
.addTick()
|
||||
.pointerMove(0, 0, {origin: b})
|
||||
.addTick()
|
||||
.addTick()
|
||||
.pointerUp()
|
||||
.send();
|
||||
|
||||
await Promise.race([dragstart_promise, mouseup_promise]);
|
||||
|
||||
const expected_events = ["mousemove", "mousedown", "mousemove", "dragstart"];
|
||||
|
||||
assert_equals(event_log.toString(), expected_events.toString(),
|
||||
"received events");
|
||||
}, "dragstart event firing when mousemove event is prevented");
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user