diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/pointerevents/mouse-pointer-boundary-events-for-shadowdom.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/pointerevents/mouse-pointer-boundary-events-for-shadowdom.html')
-rw-r--r-- | testing/web-platform/tests/pointerevents/mouse-pointer-boundary-events-for-shadowdom.html | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/testing/web-platform/tests/pointerevents/mouse-pointer-boundary-events-for-shadowdom.html b/testing/web-platform/tests/pointerevents/mouse-pointer-boundary-events-for-shadowdom.html new file mode 100644 index 0000000000..ea200d6c96 --- /dev/null +++ b/testing/web-platform/tests/pointerevents/mouse-pointer-boundary-events-for-shadowdom.html @@ -0,0 +1,74 @@ +<!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() + .addPointer("default-mouse") + .pointerMove(Math.ceil(rect.left - 10), Math.ceil(rect.top - 10)) + .send() + await resolveWhen(() => { return moveReceived == true }); + receivedEvents = []; + moveReceived = false; + + await new test_driver.Actions() + .addPointer("default-mouse") + .pointerMove(Math.ceil(rect.left + 10), Math.ceil(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() + .addPointer("default-mouse") + .pointerMove(Math.ceil(rect.left - 10), Math.ceil(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> |