diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /browser/components/uitour/test/browser_UITour5.js | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | browser/components/uitour/test/browser_UITour5.js | 60 |
1 files changed, 60 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..50316d4225 --- /dev/null +++ b/browser/components/uitour/test/browser_UITour5.js @@ -0,0 +1,60 @@ +"use strict"; + +var gTestTab; +var gContentAPI; + +add_task(setup_UITourTest); + +add_UITour_task(async function test_highlight_help_and_show_help_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("help"); + await appMenuShownPromise; + await highlightVisiblePromise; + is( + appMenu.state, + "open", + "Should open the app menu to highlight the help button" + ); + is( + getShowHighlightTargetName(), + "help", + "Should highlight the help button on the app menu" + ); + + // Click the help button to show the subview + let ViewShownPromise = new Promise(resolve => { + appMenu.addEventListener("ViewShown", resolve, { once: true }); + }); + let highlightHiddenPromise = elementHiddenPromise( + highlight, + "Should hide highlight" + ); + + let helpButtonID = "appMenu-help-button2"; + let helpBtn = document.getElementById(helpButtonID); + helpBtn.dispatchEvent(new Event("command")); + await highlightHiddenPromise; + await ViewShownPromise; + let helpView = document.getElementById("PanelUI-helpView"); + ok(PanelView.forNode(helpView).active, "Should show the help subview"); + is( + appMenu.state, + "open", + "Should still open the app menu for the help subview" + ); + + // Clean up + let appMenuHiddenPromise = promisePanelElementHidden(window, appMenu); + gContentAPI.hideMenu("appMenu"); + await appMenuHiddenPromise; + is(appMenu.state, "closed", "Should close the app menu"); +}); |