summaryrefslogtreecommitdiffstats
path: root/toolkit/components/aboutconfig/test/browser/browser_accessibility.js
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components/aboutconfig/test/browser/browser_accessibility.js')
-rw-r--r--toolkit/components/aboutconfig/test/browser/browser_accessibility.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/toolkit/components/aboutconfig/test/browser/browser_accessibility.js b/toolkit/components/aboutconfig/test/browser/browser_accessibility.js
new file mode 100644
index 0000000000..9310e40186
--- /dev/null
+++ b/toolkit/components/aboutconfig/test/browser/browser_accessibility.js
@@ -0,0 +1,39 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+const MAX_PLACEABLE_LENGTH = 2500;
+
+add_setup(async function () {
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ ["test.aboutconfig.added", "=".repeat(MAX_PLACEABLE_LENGTH)],
+ ["test.aboutconfig.long", "=".repeat(MAX_PLACEABLE_LENGTH + 1)],
+ ],
+ });
+});
+
+add_task(async function test_accessible_value() {
+ await AboutConfigTest.withNewTab(async function () {
+ for (let [name, expectHasUserValue] of [
+ [PREF_BOOLEAN_DEFAULT_TRUE, false],
+ [PREF_BOOLEAN_USERVALUE_TRUE, true],
+ ["test.aboutconfig.added", true],
+ ]) {
+ let span = this.getRow(name).valueCell.querySelector("span");
+ let expectedL10nId = expectHasUserValue
+ ? "about-config-pref-accessible-value-custom"
+ : "about-config-pref-accessible-value-default";
+ Assert.equal(span.getAttribute("data-l10n-id"), expectedL10nId);
+ }
+
+ // If the value is too long for localization, the state is not included.
+ let span = this.getRow("test.aboutconfig.long").valueCell.querySelector(
+ "span"
+ );
+ Assert.ok(!span.hasAttribute("data-l10n-id"));
+ Assert.equal(
+ span.getAttribute("aria-label"),
+ Preferences.get("test.aboutconfig.long")
+ );
+ });
+});