From 2aa4a82499d4becd2284cdb482213d541b8804dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 16:29:10 +0200 Subject: Adding upstream version 86.0.1. Signed-off-by: Daniel Baumann --- .../browser/mac/browser_aria_controls_flowto.js | 84 ++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 accessible/tests/browser/mac/browser_aria_controls_flowto.js (limited to 'accessible/tests/browser/mac/browser_aria_controls_flowto.js') 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( + ` +
Information.
+
More information.
`, + 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( + ` +
Information.
+
More information.
`, + 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( + ` + +
Information.
`, + 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"]); + } +); -- cgit v1.2.3