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 --- .../tests/browser/events/browser_test_panel.js | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 accessible/tests/browser/events/browser_test_panel.js (limited to 'accessible/tests/browser/events/browser_test_panel.js') diff --git a/accessible/tests/browser/events/browser_test_panel.js b/accessible/tests/browser/events/browser_test_panel.js new file mode 100644 index 0000000000..f2d74cc5f9 --- /dev/null +++ b/accessible/tests/browser/events/browser_test_panel.js @@ -0,0 +1,58 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +/* import-globals-from ../../mochitest/role.js */ +loadScripts({ name: "role.js", dir: MOCHITESTS_DIR }); + +// Verify we recieve hide and show notifications when the chrome +// XUL alert is closed or opened. Mac expects both notifications to +// properly communicate live region changes. +async function runTests(browser) { + ok(PopupNotifications, "PopupNotifications object exists"); + ok(PopupNotifications.panel, "PopupNotifications panel exists"); + + // When available, the popup panel makes itself a child of the chrome window. + // To verify it isn't accessible without reproducing the entirety of the chrome + // window tree, we check instead that the panel is not accessible. + ok(!isAccessible(PopupNotifications.panel), "Popup panel is not accessible"); + + const panelShown = waitForEvent(EVENT_SHOW, PopupNotifications.panel); + const notification = PopupNotifications.show( + browser, + "test-notification", + "hello world", + PopupNotifications.panel.id + ); + + await panelShown; + + ok(isAccessible(PopupNotifications.panel), "Popup panel is accessible"); + testAccessibleTree(PopupNotifications.panel, { + ALERT: [ + { + TEXT_CONTAINER: [ + { LABEL: [{ TEXT_LEAF: [] }] }, + { PUSHBUTTON: [] }, + { PUSHBUTTON: [] }, + ], + }, + ], + }); + // Verify the popup panel is associated with the chrome window. + is( + PopupNotifications.panel.ownerGlobal, + getMainChromeWindow(window), + "Popup panel is associated with the chrome window" + ); + + const panelHidden = waitForEvent(EVENT_HIDE, PopupNotifications.panel); + PopupNotifications.remove(notification); + + await panelHidden; + + ok(!isAccessible(PopupNotifications.panel), "Popup panel is not accessible"); +} + +addAccessibleTask(``, runTests); -- cgit v1.2.3