From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- .../browser/mac/browser_aria_controls_flowto.js | 92 ++++++++++++++++++++++ 1 file changed, 92 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..5950a60399 --- /dev/null +++ b/accessible/tests/browser/mac/browser_aria_controls_flowto.js @@ -0,0 +1,92 @@ +/* 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 getAriaControls = id => + JSON.stringify( + getNativeInterface(accDoc, id) + .getAttributeValue("AXARIAControls") + .map(e => e.getAttributeValue("AXDOMIdentifier")) + ); + + await untilCacheIs( + () => getAriaControls("info-button"), + JSON.stringify(["info"]), + "Info-button has correct initial controls" + ); + + await SpecialPowers.spawn(browser, [], () => { + content.document + .getElementById("info-button") + .setAttribute("aria-controls", "info more-info"); + }); + + await untilCacheIs( + () => getAriaControls("info-button"), + JSON.stringify(["info", "more-info"]), + "Info-button has correct controls after mutation" + ); + } +); + +function getLinkedUIElements(accDoc, id) { + return JSON.stringify( + getNativeInterface(accDoc, id) + .getAttributeValue("AXLinkedUIElements") + .map(e => e.getAttributeValue("AXDOMIdentifier")) + ); +} + +/** + * Test aria-flowto + */ +addAccessibleTask( + ` +
Information.
+
More information.
`, + async (browser, accDoc) => { + await untilCacheIs( + () => getLinkedUIElements(accDoc, "info-button"), + JSON.stringify(["info"]), + "Info-button has correct initial linked elements" + ); + + await SpecialPowers.spawn(browser, [], () => { + content.document + .getElementById("info-button") + .setAttribute("aria-flowto", "info more-info"); + }); + + await untilCacheIs( + () => getLinkedUIElements(accDoc, "info-button"), + JSON.stringify(["info", "more-info"]), + "Info-button has correct linked elements after mutation" + ); + } +); + +/** + * Test aria-controls + */ +addAccessibleTask( + ` + +
Information.
`, + async (browser, accDoc) => { + await untilCacheIs( + () => getLinkedUIElements(accDoc, "dog-radio"), + JSON.stringify(["cat-radio", "dog-radio", "info"]), + "dog-radio has correct linked elements" + ); + } +); -- cgit v1.2.3