summaryrefslogtreecommitdiffstats
path: root/accessible/tests/browser/events
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:50 +0000
commitdef92d1b8e9d373e2f6f27c366d578d97d8960c6 (patch)
tree2ef34b9ad8bb9a9220e05d60352558b15f513894 /accessible/tests/browser/events
parentAdding debian version 125.0.3-1. (diff)
downloadfirefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.tar.xz
firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'accessible/tests/browser/events')
-rw-r--r--accessible/tests/browser/events/browser.toml3
-rw-r--r--accessible/tests/browser/events/browser_content_prompt.js48
2 files changed, 50 insertions, 1 deletions
diff --git a/accessible/tests/browser/events/browser.toml b/accessible/tests/browser/events/browser.toml
index 7ec3c3621a..ffbb96cfbb 100644
--- a/accessible/tests/browser/events/browser.toml
+++ b/accessible/tests/browser/events/browser.toml
@@ -4,12 +4,13 @@ support-files = [
"head.js",
"!/accessible/tests/browser/shared-head.js",
"!/accessible/tests/mochitest/*.js",
- "!/accessible/tests/browser/*.jsm",
]
prefs = ["javascript.options.asyncstack_capture_debuggee_only=false"]
["browser_alert.js"]
+["browser_content_prompt.js"]
+
["browser_test_A11yUtils_announce.js"]
["browser_test_caret_move_granularity.js"]
diff --git a/accessible/tests/browser/events/browser_content_prompt.js b/accessible/tests/browser/events/browser_content_prompt.js
new file mode 100644
index 0000000000..7677c0258a
--- /dev/null
+++ b/accessible/tests/browser/events/browser_content_prompt.js
@@ -0,0 +1,48 @@
+/* Any copyright is dedicated to the Public Domain.
+ https://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+// Want to test relations.
+/* import-globals-from ../../mochitest/name.js */
+/* import-globals-from ../../mochitest/relations.js */
+/* import-globals-from ../../mochitest/role.js */
+loadScripts(
+ { name: "relations.js", dir: MOCHITESTS_DIR },
+ { name: "name.js", dir: MOCHITESTS_DIR },
+ { name: "role.js", dir: MOCHITESTS_DIR }
+);
+
+addAccessibleTask(``, async function (browser) {
+ info("Showing alert");
+ let shown = waitForEvent(
+ EVENT_SHOW,
+ evt => evt.accessible.role == ROLE_INTERNAL_FRAME
+ );
+ // Let's make sure the dialog content gets focus.
+ // On macOS, we unfortunately focus the label. We focus the OK button on
+ // all other platforms. See https://phabricator.services.mozilla.com/D204908
+ // for more discussion.
+ let expectedRole =
+ AppConstants.platform == "macosx" ? ROLE_LABEL : ROLE_PUSHBUTTON;
+ let focused = waitForEvent(EVENT_FOCUS, evt => {
+ return evt.accessible.role == expectedRole;
+ });
+ await invokeContentTask(browser, [], () => {
+ // Use setTimeout to avoid blocking the return of the content task
+ // on the alert, which is otherwise synchronous.
+ content.setTimeout(() => content.alert("test"), 0);
+ });
+ const frame = (await shown).accessible;
+ const focusedEl = (await focused).accessible;
+ ok(true, "Dialog shown and something got focused");
+ let dialog = getAccessible(focusedEl.DOMNode.ownerDocument);
+ testRole(dialog, ROLE_DIALOG);
+ let infoBody = focusedEl.DOMNode.ownerDocument.getElementById("infoBody");
+ testRelation(dialog, RELATION_DESCRIBED_BY, infoBody);
+ testDescr(dialog, "test ");
+ info("Dismissing alert");
+ let hidden = waitForEvent(EVENT_HIDE, frame);
+ EventUtils.synthesizeKey("KEY_Escape", {}, frame.DOMNode.contentWindow);
+ await hidden;
+});