summaryrefslogtreecommitdiffstats
path: root/browser/components/customizableui/test/browser_panelUINotifications_fullscreen.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /browser/components/customizableui/test/browser_panelUINotifications_fullscreen.js
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/customizableui/test/browser_panelUINotifications_fullscreen.js')
-rw-r--r--browser/components/customizableui/test/browser_panelUINotifications_fullscreen.js92
1 files changed, 92 insertions, 0 deletions
diff --git a/browser/components/customizableui/test/browser_panelUINotifications_fullscreen.js b/browser/components/customizableui/test/browser_panelUINotifications_fullscreen.js
new file mode 100644
index 0000000000..4b3340696b
--- /dev/null
+++ b/browser/components/customizableui/test/browser_panelUINotifications_fullscreen.js
@@ -0,0 +1,92 @@
+"use strict";
+
+const { AppMenuNotifications } = ChromeUtils.importESModule(
+ "resource://gre/modules/AppMenuNotifications.sys.mjs"
+);
+
+add_task(async function testFullscreen() {
+ is(
+ PanelUI.notificationPanel.state,
+ "closed",
+ "update-manual doorhanger is closed."
+ );
+ let mainActionCalled = false;
+ let mainAction = {
+ callback: () => {
+ mainActionCalled = true;
+ },
+ };
+ AppMenuNotifications.showNotification("update-manual", mainAction);
+
+ isnot(
+ PanelUI.notificationPanel.state,
+ "closed",
+ "update-manual doorhanger is showing."
+ );
+ let notifications = [...PanelUI.notificationPanel.children].filter(
+ n => !n.hidden
+ );
+ is(
+ notifications.length,
+ 1,
+ "PanelUI doorhanger is only displaying one notification."
+ );
+ let doorhanger = notifications[0];
+ is(
+ doorhanger.id,
+ "appMenu-update-manual-notification",
+ "PanelUI is displaying the update-manual notification."
+ );
+
+ let popuphiddenPromise = BrowserTestUtils.waitForEvent(
+ PanelUI.notificationPanel,
+ "popuphidden"
+ );
+ document.documentElement.focus();
+ EventUtils.synthesizeKey("KEY_F11");
+ await popuphiddenPromise;
+ await new Promise(executeSoon);
+ is(
+ PanelUI.notificationPanel.state,
+ "closed",
+ "update-manual doorhanger is closed."
+ );
+
+ FullScreen.showNavToolbox();
+ is(
+ PanelUI.menuButton.getAttribute("badge-status"),
+ "update-manual",
+ "Badge is displaying on PanelUI button."
+ );
+
+ let popupshownPromise = BrowserTestUtils.waitForEvent(
+ PanelUI.notificationPanel,
+ "popupshown"
+ );
+ EventUtils.synthesizeKey("KEY_F11");
+ await popupshownPromise;
+ await new Promise(executeSoon);
+ isnot(
+ PanelUI.notificationPanel.state,
+ "closed",
+ "update-manual doorhanger is showing."
+ );
+ isnot(
+ PanelUI.menuButton.getAttribute("badge-status"),
+ "update-manual",
+ "Badge is not displaying on PanelUI button."
+ );
+
+ doorhanger.button.click();
+ ok(mainActionCalled, "Main action callback was called");
+ is(
+ PanelUI.notificationPanel.state,
+ "closed",
+ "update-manual doorhanger is closed."
+ );
+ is(
+ PanelUI.menuButton.hasAttribute("badge-status"),
+ false,
+ "Should not have a badge status"
+ );
+});