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/components/newtab/test/browser/browser_newtab_towindow.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/components/newtab/test/browser/browser_newtab_towindow.js')
-rw-r--r-- | browser/components/newtab/test/browser/browser_newtab_towindow.js | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/browser/components/newtab/test/browser/browser_newtab_towindow.js b/browser/components/newtab/test/browser/browser_newtab_towindow.js new file mode 100644 index 0000000000..d0a49e63f0 --- /dev/null +++ b/browser/components/newtab/test/browser/browser_newtab_towindow.js @@ -0,0 +1,45 @@ +// This test simulates opening the newtab page and moving it to a new window. +// Links in the page should still work. +add_task(async function test_newtab_to_window() { + await setTestTopSites(); + + let tab = await BrowserTestUtils.openNewForegroundTab( + gBrowser, + "about:newtab", + false + ); + + let swappedPromise = BrowserTestUtils.waitForEvent( + tab.linkedBrowser, + "SwapDocShells" + ); + let newWindow = gBrowser.replaceTabWithWindow(tab); + await swappedPromise; + + is( + newWindow.gBrowser.selectedBrowser.currentURI.spec, + "about:newtab", + "about:newtab moved to window" + ); + + let tabPromise = BrowserTestUtils.waitForNewTab( + newWindow.gBrowser, + "https://example.com/", + true + ); + + await BrowserTestUtils.synthesizeMouse( + `.top-sites a`, + 2, + 2, + { accelKey: true }, + newWindow.gBrowser.selectedBrowser + ); + + await tabPromise; + + is(newWindow.gBrowser.tabs.length, 2, "second page is opened"); + + BrowserTestUtils.removeTab(newWindow.gBrowser.selectedTab); + await BrowserTestUtils.closeWindow(newWindow); +}); |