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 /toolkit/components/aboutconfig/test/browser/browser_accessibility.js | |
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 'toolkit/components/aboutconfig/test/browser/browser_accessibility.js')
-rw-r--r-- | toolkit/components/aboutconfig/test/browser/browser_accessibility.js | 39 |
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") + ); + }); +}); |