-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add shadow dom boundary event test to wpt
Move more internal pointerevent tests to wpt Change-Id: I7e44eda0af004cb4ebdb07610923b067c07a3341 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2167991 Reviewed-by: Lan Wei <[email protected]> Commit-Queue: Navid Zolghadr <[email protected]> Cr-Commit-Position: refs/heads/master@{#762990}
- Loading branch information
1 parent
d931241
commit f657d26
Showing
1 changed file
with
71 additions
and
0 deletions.
There are no files selected for viewing
71 changes: 71 additions & 0 deletions
71
pointerevents/mouse-pointer-boundary-events-for-shadowdom.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<!DOCTYPE HTML> | ||
<meta name="viewport" content="width=device-width"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/resources/testdriver.js"></script> | ||
<script src="/resources/testdriver-actions.js"></script> | ||
<script src="/resources/testdriver-vendor.js"></script> | ||
<script type="text/javascript" src="pointerevent_support.js"></script> | ||
|
||
<h1>PointerEvent: Verifies that mouse boundary events don't point to shadow-dom</h1> | ||
|
||
<input id="target" style="margin: 20px"> | ||
|
||
<script> | ||
function name(node) { | ||
return node? node.tagName : "(null)"; | ||
} | ||
|
||
promise_test(async () => { | ||
var targetEvents = ["mouseout", "pointerout", "mouseover", "pointerover"]; | ||
var receivedEvents = []; | ||
var moveReceived = false; | ||
|
||
|
||
targetEvents.forEach(function(eventName) { | ||
window.addEventListener(eventName, function(e) { | ||
var eventDetails = e.type + | ||
" target=" + name(e.target) + | ||
" relatedTarget=" + name(e.relatedTarget); | ||
receivedEvents.push(eventDetails); | ||
}); | ||
}); | ||
window.addEventListener('pointermove', () => { moveReceived = true; }); | ||
var rect = document.getElementById("target").getBoundingClientRect(); | ||
|
||
await new test_driver.Actions() | ||
.pointerMove(rect.left - 10, rect.top - 10) | ||
.send() | ||
|
||
receivedEvents = []; | ||
moveReceived = false; | ||
|
||
await new test_driver.Actions() | ||
.pointerMove(rect.left + 10, rect.top + 10) | ||
.send() | ||
await resolveWhen(() => { return moveReceived == true }); | ||
|
||
assert_array_equals(receivedEvents, [ | ||
"pointerout target=BODY relatedTarget=INPUT", | ||
"pointerover target=INPUT relatedTarget=BODY", | ||
"mouseout target=BODY relatedTarget=INPUT", | ||
"mouseover target=INPUT relatedTarget=BODY", | ||
], "Moved into <input>"); | ||
|
||
|
||
receivedEvents = []; | ||
moveReceived = false; | ||
|
||
await new test_driver.Actions() | ||
.pointerMove(rect.left - 10, rect.top - 10) | ||
.send() | ||
await resolveWhen(() => { return moveReceived == true }); | ||
|
||
assert_array_equals(receivedEvents, [ | ||
"pointerout target=INPUT relatedTarget=BODY", | ||
"pointerover target=BODY relatedTarget=INPUT", | ||
"mouseout target=INPUT relatedTarget=BODY", | ||
"mouseover target=BODY relatedTarget=INPUT", | ||
], "Moved out of <input>"); | ||
}, "PointerEvent: Verifies that mouse boundary events don't point to shadow-dom"); | ||
</script> |