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/uievents/order-of-events/focus-events/focus-contained.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/uievents/order-of-events/focus-events/focus-contained.html')
-rw-r--r-- | testing/web-platform/tests/uievents/order-of-events/focus-events/focus-contained.html | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/testing/web-platform/tests/uievents/order-of-events/focus-events/focus-contained.html b/testing/web-platform/tests/uievents/order-of-events/focus-events/focus-contained.html new file mode 100644 index 0000000000..8df612c108 --- /dev/null +++ b/testing/web-platform/tests/uievents/order-of-events/focus-events/focus-contained.html @@ -0,0 +1,94 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8"> + <title>Focus-related events should fire in the correct order</title> + <link rel="help" href="https://w3c.github.io/uievents/#events-focusevent-event-order"> + <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 src="/uievents/resources/eventrecorder.js"></script> +</head> + +<body> + <ol> + <li>Click into the text input.</li> + <li>Click just below the text input.</li> + <li>Click into the text input again.</li> + <li>Click the "Done" button.</li> + </ol> + <div id="a" tabindex="1" style="width:400px; height:300px"> + <br /><br /><br /> + <input type="text", id="b"></div> + </div> + <button type="button" id="done">Done</button> +</body> + +<script> +setup({explicit_timeout: true}); +function stopPropagation(e) { + e.stopPropagation(); +} +var relevantEvents = [ + "focus", + "blur", + "focusin", + "focusout" +]; +window.onload = async function () { + var a = document.getElementById("a"); + var b = document.getElementById("b"); + var button = document.getElementById("done"); + var inputs = [a, b]; + EventRecorder.configure({ + objectMap: { + "a": a, + "b": b, + } + }); + + EventRecorder.addEventListenersForNodes(relevantEvents, inputs, stopPropagation); + var expected = [ + {type: "focus", target: "b"}, + {type: "focusin", target: "b"}, + {type: "blur", target: "b"}, + {type: "focusout", target: "b"}, + {type: "focus", target: "a"}, + {type: "focusin", target: "a"}, + {type: "blur", target: "a"}, + {type: "focusout", target: "a"}, + {type: "focus", target: "b"}, + {type: "focusin", target: "b"}, + {type: "blur", target: "b"}, + {type: "focusout", target: "b"} + ]; + + async_test(function(t) { + button.addEventListener("click", function () { + t.step(function () { + assert_true(EventRecorder.checkRecords(expected)); + t.done(); + }); + }, false); + }, "Focus-related events should fire in the correct order"); + EventRecorder.start(); + + await new test_driver.Actions() + .pointerMove(0, 0, {origin: b}) + .pointerDown() + .pointerUp() + .pointerMove(0, 0, {origin: a}) + .pointerDown() + .pointerUp() + .pointerMove(0, 0, {origin: b}) + .pointerDown() + .pointerUp() + .pointerMove(0, 0, {origin: button}) + .pointerDown() + .pointerUp() + .send(); +}; +</script> +</html>
\ No newline at end of file |