diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
commit | 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch) | |
tree | a31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /testing/web-platform/mozilla/tests/dom/focus-invalid-uri-link.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip |
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/mozilla/tests/dom/focus-invalid-uri-link.html')
-rw-r--r-- | testing/web-platform/mozilla/tests/dom/focus-invalid-uri-link.html | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/testing/web-platform/mozilla/tests/dom/focus-invalid-uri-link.html b/testing/web-platform/mozilla/tests/dom/focus-invalid-uri-link.html new file mode 100644 index 0000000000..5de81c866f --- /dev/null +++ b/testing/web-platform/mozilla/tests/dom/focus-invalid-uri-link.html @@ -0,0 +1,63 @@ +<!doctype html> +<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> +function abs(uri) { + return new URL(uri, window.location.href).href; +} +const CHILD_DOC = ` +<!doctype html> +<script src="${abs("/resources/testdriver.js")}"></` + `script> +<script src="${abs("/resources/testdriver-actions.js")}"></` + `script> +<script src="${abs("/resources/testdriver-vendor.js")}"></` + `script> +<script> + test_driver.set_test_context(opener); +</` + `script> + +<a href>To link or not to link</a> + +<script> +onload = async function() { + let link = document.querySelector("a"); + link.focus(); + let focused = document.activeElement == link; + let clicked = new Promise(resolve => { + link.addEventListener("click", resolve, { once: true }); + }); + const enterKey = '\\uE007'; + await test_driver.send_keys(link, enterKey); + await clicked; + test_driver.message_test({ testResult: true, focused, clicked: true }); +}; +</` + `script> +` + +promise_test(async function(t) { + await new Promise(resolve => { + window.onload = resolve; + }) + + let messagePromise = new Promise(resolve => { + addEventListener("message", function(msg) { + if (msg.data.testResult) { + resolve(msg); + } + }); + }); + + let win = window.open("data:text/html," + escape(CHILD_DOC)); + + assert_true(true, "Window opened"); + let message = await messagePromise; + assert_true(true, "message: " + JSON.stringify(message)); + + let { focused, clicked } = message.data; + assert_true(focused, "Link should be focusable"); + assert_true(clicked, "Link should be keyboard activatable"); + + win.close(); +}, "Link to invalid URI should be focusable and keyboard activatable"); +</script> |