diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /browser/base/content/test/tabPrompts/browser_closeTabSpecificPanels.js | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/base/content/test/tabPrompts/browser_closeTabSpecificPanels.js')
-rw-r--r-- | browser/base/content/test/tabPrompts/browser_closeTabSpecificPanels.js | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/browser/base/content/test/tabPrompts/browser_closeTabSpecificPanels.js b/browser/base/content/test/tabPrompts/browser_closeTabSpecificPanels.js new file mode 100644 index 0000000000..8d789ad512 --- /dev/null +++ b/browser/base/content/test/tabPrompts/browser_closeTabSpecificPanels.js @@ -0,0 +1,53 @@ +"use strict"; + +/* + * This test creates multiple panels, one that has been tagged as specific to its tab's content + * and one that isn't. When a tab loses focus, panel specific to that tab should close. + * The non-specific panel should remain open. + * + */ + +add_task(async function () { + let tab1 = BrowserTestUtils.addTab(gBrowser, "http://mochi.test:8888/#0"); + let tab2 = BrowserTestUtils.addTab(gBrowser, "http://mochi.test:8888/#1"); + let specificPanel = document.createXULElement("panel"); + specificPanel.setAttribute("tabspecific", "true"); + specificPanel.setAttribute("noautohide", "true"); + let generalPanel = document.createXULElement("panel"); + generalPanel.setAttribute("noautohide", "true"); + let anchor = document.getElementById(CustomizableUI.AREA_NAVBAR); + + anchor.appendChild(specificPanel); + anchor.appendChild(generalPanel); + is(specificPanel.state, "closed", "specificPanel starts as closed"); + is(generalPanel.state, "closed", "generalPanel starts as closed"); + + let specificPanelPromise = BrowserTestUtils.waitForEvent( + specificPanel, + "popupshown" + ); + specificPanel.openPopupAtScreen(210, 210); + await specificPanelPromise; + is(specificPanel.state, "open", "specificPanel has been opened"); + + let generalPanelPromise = BrowserTestUtils.waitForEvent( + generalPanel, + "popupshown" + ); + generalPanel.openPopupAtScreen(510, 510); + await generalPanelPromise; + is(generalPanel.state, "open", "generalPanel has been opened"); + + gBrowser.tabContainer.advanceSelectedTab(-1, true); + is( + specificPanel.state, + "closed", + "specificPanel panel is closed after its tab loses focus" + ); + is(generalPanel.state, "open", "generalPanel is still open after tab switch"); + + specificPanel.remove(); + generalPanel.remove(); + gBrowser.removeTab(tab1); + gBrowser.removeTab(tab2); +}); |