diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /accessible/tests/browser/mac/browser_aria_controls_flowto.js | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'accessible/tests/browser/mac/browser_aria_controls_flowto.js')
-rw-r--r-- | accessible/tests/browser/mac/browser_aria_controls_flowto.js | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/accessible/tests/browser/mac/browser_aria_controls_flowto.js b/accessible/tests/browser/mac/browser_aria_controls_flowto.js new file mode 100644 index 0000000000..c1b75b8318 --- /dev/null +++ b/accessible/tests/browser/mac/browser_aria_controls_flowto.js @@ -0,0 +1,84 @@ +/* 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 aria-controls + */ +addAccessibleTask( + `<button aria-controls="info" id="info-button">Show info</button> + <div id="info">Information.</div> + <div id="more-info">More information.</div>`, + async (browser, accDoc) => { + const isARIAControls = (id, expectedIds) => + Assert.deepEqual( + getNativeInterface(accDoc, id) + .getAttributeValue("AXARIAControls") + .map(e => e.getAttributeValue("AXDOMIdentifier")), + expectedIds, + `"${id}" has correct AXARIAControls` + ); + + isARIAControls("info-button", ["info"]); + + await SpecialPowers.spawn(browser, [], () => { + content.document + .getElementById("info-button") + .setAttribute("aria-controls", "info more-info"); + }); + + isARIAControls("info-button", ["info", "more-info"]); + } +); + +/** + * Test aria-flowto + */ +addAccessibleTask( + `<button aria-flowto="info" id="info-button">Show info</button> + <div id="info">Information.</div> + <div id="more-info">More information.</div>`, + async (browser, accDoc) => { + const isLinkedUIElements = (id, expectedIds) => + Assert.deepEqual( + getNativeInterface(accDoc, id) + .getAttributeValue("AXLinkedUIElements") + .map(e => e.getAttributeValue("AXDOMIdentifier")), + expectedIds, + `"${id}" has correct AXARIAControls` + ); + + isLinkedUIElements("info-button", ["info"]); + + await SpecialPowers.spawn(browser, [], () => { + content.document + .getElementById("info-button") + .setAttribute("aria-flowto", "info more-info"); + }); + + isLinkedUIElements("info-button", ["info", "more-info"]); + } +); + +/** + * Test aria-controls + */ +addAccessibleTask( + `<input type="radio" id="cat-radio" name="animal"><label for="cat">Cat</label> + <input type="radio" id="dog-radio" name="animal" aria-flowto="info"><label for="dog">Dog</label> + <div id="info">Information.</div>`, + async (browser, accDoc) => { + const isLinkedUIElements = (id, expectedIds) => + Assert.deepEqual( + getNativeInterface(accDoc, id) + .getAttributeValue("AXLinkedUIElements") + .map(e => e.getAttributeValue("AXDOMIdentifier")), + expectedIds, + `"${id}" has correct AXARIAControls` + ); + + isLinkedUIElements("dog-radio", ["cat-radio", "dog-radio", "info"]); + } +); |