summaryrefslogtreecommitdiffstats
path: root/browser/components/uitour/test/browser_UITour5.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /browser/components/uitour/test/browser_UITour5.js
parentInitial commit. (diff)
downloadfirefox-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 'browser/components/uitour/test/browser_UITour5.js')
-rw-r--r--browser/components/uitour/test/browser_UITour5.js61
1 files changed, 61 insertions, 0 deletions
diff --git a/browser/components/uitour/test/browser_UITour5.js b/browser/components/uitour/test/browser_UITour5.js
new file mode 100644
index 0000000000..b6094b42fc
--- /dev/null
+++ b/browser/components/uitour/test/browser_UITour5.js
@@ -0,0 +1,61 @@
+"use strict";
+
+var gTestTab;
+var gContentAPI;
+var gContentWindow;
+
+add_task(setup_UITourTest);
+
+add_UITour_task(
+ async function test_highlight_library_and_show_library_subview() {
+ let highlight = document.getElementById("UITourHighlight");
+ is_element_hidden(highlight, "Highlight should initially be hidden");
+
+ // Test highlighting the library button
+ let appMenu = PanelUI.panel;
+ let appMenuShownPromise = promisePanelElementShown(window, appMenu);
+ let highlightVisiblePromise = elementVisiblePromise(
+ highlight,
+ "Should show highlight"
+ );
+ gContentAPI.showHighlight("library");
+ await appMenuShownPromise;
+ await highlightVisiblePromise;
+ is(
+ appMenu.state,
+ "open",
+ "Should open the app menu to highlight the library button"
+ );
+ is(
+ getShowHighlightTargetName(),
+ "library",
+ "Should highlight the library button on the app menu"
+ );
+
+ // Click the library button to show the subview
+ let ViewShownPromise = new Promise(resolve => {
+ appMenu.addEventListener("ViewShown", resolve, { once: true });
+ });
+ let highlightHiddenPromise = elementHiddenPromise(
+ highlight,
+ "Should hide highlight"
+ );
+ let libraryBtn = document.getElementById("appMenu-library-button");
+ libraryBtn.dispatchEvent(new Event("command"));
+ await highlightHiddenPromise;
+ await ViewShownPromise;
+ let libView = document.getElementById("appMenu-libraryView");
+ ok(PanelView.forNode(libView).active, "Should show the library subview");
+ is(
+ appMenu.state,
+ "open",
+ "Should still open the app menu for the library subview"
+ );
+
+ // Clean up
+ let appMenuHiddenPromise = promisePanelElementHidden(window, appMenu);
+ gContentAPI.hideMenu("appMenu");
+ await appMenuHiddenPromise;
+ is(appMenu.state, "closed", "Should close the app menu");
+ }
+);