summaryrefslogtreecommitdiffstats
path: root/accessible/tests/browser/mac
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:42 +0000
commitda4c7e7ed675c3bf405668739c3012d140856109 (patch)
treecdd868dba063fecba609a1d819de271f0d51b23e /accessible/tests/browser/mac
parentAdding upstream version 125.0.3. (diff)
downloadfirefox-da4c7e7ed675c3bf405668739c3012d140856109.tar.xz
firefox-da4c7e7ed675c3bf405668739c3012d140856109.zip
Adding upstream version 126.0.upstream/126.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'accessible/tests/browser/mac')
-rw-r--r--accessible/tests/browser/mac/browser.toml3
-rw-r--r--accessible/tests/browser/mac/browser_aria_placeholder.js70
-rw-r--r--accessible/tests/browser/mac/browser_roles_elements.js4
-rw-r--r--accessible/tests/browser/mac/browser_selectables.js23
4 files changed, 74 insertions, 26 deletions
diff --git a/accessible/tests/browser/mac/browser.toml b/accessible/tests/browser/mac/browser.toml
index b180a42ab7..227575fb4d 100644
--- a/accessible/tests/browser/mac/browser.toml
+++ b/accessible/tests/browser/mac/browser.toml
@@ -9,7 +9,6 @@ support-files = [
"doc_menulist.xhtml",
"doc_tree.xhtml",
"!/accessible/tests/browser/shared-head.js",
- "!/accessible/tests/browser/*.jsm",
"!/accessible/tests/mochitest/*.js",
"!/accessible/tests/mochitest/letters.gif",
"!/accessible/tests/mochitest/moz.png",
@@ -29,6 +28,8 @@ https_first_disabled = true
["browser_aria_haspopup.js"]
+["browser_aria_placeholder.js"]
+
["browser_aria_setsize.js"]
["browser_attributed_text.js"]
diff --git a/accessible/tests/browser/mac/browser_aria_placeholder.js b/accessible/tests/browser/mac/browser_aria_placeholder.js
new file mode 100644
index 0000000000..e5102fd093
--- /dev/null
+++ b/accessible/tests/browser/mac/browser_aria_placeholder.js
@@ -0,0 +1,70 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+"use strict";
+
+/**
+ * Test that inputs with placeholder text expose it via AXPlaceholderValue and
+ * correctly _avoid_ exposing it via AXTItle, AXValue, or AXDescription. Verify AXPlaceholderValue is not exposed when the placeholder is used as the name.
+ */
+addAccessibleTask(
+ `
+ <input id="input" placeholder="Name"><br>
+ <label for="input2">Enter Name</label><input id="input2" placeholder="Name" value="Elmer Fudd">
+ `,
+ (browser, accDoc) => {
+ let input = getNativeInterface(accDoc, "input");
+ let input2 = getNativeInterface(accDoc, "input2");
+
+ is(
+ input.getAttributeValue("AXPlaceholderValue"),
+ null,
+ "Placeholder is used as name, so no AXPlaceholderValue is stored."
+ );
+ is(input.getAttributeValue("AXDescription"), "Name");
+ is(input.getAttributeValue("AXTitle"), "", "Correct title");
+ is(input.getAttributeValue("AXValue"), "", "Correct value");
+
+ is(
+ input2.getAttributeValue("AXPlaceholderValue"),
+ "Name",
+ "Correct placeholder value in presence of value"
+ );
+ is(
+ input2.getAttributeValue("AXDescription"),
+ "Enter Name",
+ "Correct label"
+ );
+ is(input2.getAttributeValue("AXTitle"), "", "Correct title");
+ is(input2.getAttributeValue("AXValue"), "Elmer Fudd", "Correct value");
+ }
+);
+
+/**
+ * Test that aria-placeholder gets exposed via AXPlaceholderValue and correctly
+ * contributes to AXValue (but not title or description).
+ */
+addAccessibleTask(
+ `
+ <span id="date-of-birth">Birthday</span>
+ <div
+ id="bday"
+ contenteditable
+ role="textbox"
+ aria-labelledby="date-of-birth"
+ aria-placeholder="MM-DD-YYYY">MM-DD-YYYY</div>
+ `,
+ (browser, accDoc) => {
+ let bday = getNativeInterface(accDoc, "bday");
+
+ is(
+ bday.getAttributeValue("AXPlaceholderValue"),
+ "MM-DD-YYYY",
+ "Correct placeholder value"
+ );
+ is(bday.getAttributeValue("AXDescription"), "Birthday", "Correct label");
+ is(bday.getAttributeValue("AXTitle"), "", "Correct title");
+ is(bday.getAttributeValue("AXValue"), "MM-DD-YYYY", "Correct value");
+ }
+);
diff --git a/accessible/tests/browser/mac/browser_roles_elements.js b/accessible/tests/browser/mac/browser_roles_elements.js
index b6049e7afd..65caf308c4 100644
--- a/accessible/tests/browser/mac/browser_roles_elements.js
+++ b/accessible/tests/browser/mac/browser_roles_elements.js
@@ -73,8 +73,8 @@ addAccessibleTask(
<div id="switch" role="switch"></div>
<div id="timer" role="timer"></div>
<div id="tooltip" role="tooltip"></div>
- <input type="radio" role="menuitemradio" id="menuitemradio">
- <input type="checkbox" role="menuitemcheckbox" id="menuitemcheckbox">
+ <div role="menu"><input type="radio" role="menuitemradio" id="menuitemradio"></div>
+ <div role="menu"><input type="checkbox" role="menuitemcheckbox" id="menuitemcheckbox"></div>
<input type="datetime-local" id="datetime">
<!-- text entries -->
diff --git a/accessible/tests/browser/mac/browser_selectables.js b/accessible/tests/browser/mac/browser_selectables.js
index af88c2e136..cc489e566d 100644
--- a/accessible/tests/browser/mac/browser_selectables.js
+++ b/accessible/tests/browser/mac/browser_selectables.js
@@ -300,9 +300,6 @@ addAccessibleTask(
async (browser, accDoc) => {
let select = getNativeInterface(accDoc, "select");
let one = getNativeInterface(accDoc, "one");
- let two = getNativeInterface(accDoc, "two");
- let three = getNativeInterface(accDoc, "three");
- let four = getNativeInterface(accDoc, "four");
is(
select.getAttributeValue("AXTitle"),
@@ -339,25 +336,5 @@ addAccessibleTask(
});
await evt;
is(select.getAttributeValue("AXSelectedChildren").length, 0);
- evt = waitForMacEvent("AXSelectedChildrenChanged");
- three.setAttributeValue("AXSelected", true);
- await evt;
- is(select.getAttributeValue("AXSelectedChildren").length, 1);
- ok(getSelectedIds(select).includes("three"), "'three' is selected");
- evt = waitForMacEvent("AXSelectedChildrenChanged");
- select.setAttributeValue("AXSelectedChildren", [one, two]);
- await evt;
- await untilCacheOk(() => {
- let ids = getSelectedIds(select);
- return ids[0] == "one" && ids[1] == "two";
- }, "Got correct selected children");
-
- evt = waitForMacEvent("AXSelectedChildrenChanged");
- select.setAttributeValue("AXSelectedChildren", [three, two, four]);
- await evt;
- await untilCacheOk(() => {
- let ids = getSelectedIds(select);
- return ids[0] == "two" && ids[1] == "three";
- }, "Got correct selected children");
}
);