mirror of
https://github.com/zen-browser/desktop.git
synced 2026-04-30 11:14:19 +00:00
fix: Fixed restoring tabs after restoring windows, b=bug #8699, c=workspaces, tests
This commit is contained in:
@@ -8,5 +8,7 @@ support-files = [
|
||||
["browser_double_click_newtab.js"]
|
||||
["browser_overflow_scrollbox.js"]
|
||||
|
||||
["browser_issue_8699.js"]
|
||||
|
||||
["browser_private_mode.js"]
|
||||
["browser_private_mode_startup.js"]
|
||||
|
||||
47
src/zen/tests/workspaces/browser_issue_8699.js
Normal file
47
src/zen/tests/workspaces/browser_issue_8699.js
Normal file
@@ -0,0 +1,47 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
https://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
'use strict';
|
||||
|
||||
add_task(async function test_Restore_Closed_Tabs() {
|
||||
const currentTab = gBrowser.selectedTab;
|
||||
const tabsToClose = [];
|
||||
for (let i = 0; i < 3; i++) {
|
||||
const tab = await BrowserTestUtils.openNewForegroundTab(
|
||||
window.gBrowser,
|
||||
`https://example.com/${i}`,
|
||||
true,
|
||||
{ skipAnimation: true }
|
||||
);
|
||||
tabsToClose.push(tab);
|
||||
}
|
||||
gBrowser.selectedTab = tabsToClose[0];
|
||||
await TabStateFlusher.flushWindow(window);
|
||||
Assert.equal(
|
||||
gBrowser.tabs.length,
|
||||
5, // 1 initial tab + 3 new tabs
|
||||
'There should be four tabs after opening three new tabs'
|
||||
);
|
||||
gBrowser.removeTabs(tabsToClose);
|
||||
await TabStateFlusher.flushWindow(window);
|
||||
await new Promise((resolve) => {
|
||||
Assert.equal(
|
||||
gBrowser.selectedTab,
|
||||
currentTab,
|
||||
'Current tab should still be selected after closing tabs'
|
||||
);
|
||||
Assert.equal(gBrowser.tabs.length, 2, 'There should be one tab left after closing all tabs');
|
||||
restoreLastClosedTabOrWindowOrSession();
|
||||
ok(!currentTab.selected, 'Current tab should not be selected after restore');
|
||||
Assert.equal(
|
||||
gBrowser.tabs.length,
|
||||
5, // 1 initial tab + 3 restored tabs
|
||||
'There should be four tabs after restoring closed tabs'
|
||||
);
|
||||
gBrowser.selectedTab = currentTab;
|
||||
resolve();
|
||||
});
|
||||
for (const tab of gBrowser.tabs.filter((t) => t !== currentTab)) {
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
}
|
||||
});
|
||||
@@ -12,7 +12,7 @@ add_task(async function test_Private_Mode_Startup() {
|
||||
setTimeout(() => {
|
||||
Assert.equal(
|
||||
privateWindow.gBrowser.tabs.length,
|
||||
1,
|
||||
2,
|
||||
'Private window should start with one tab'
|
||||
);
|
||||
resolve();
|
||||
|
||||
Reference in New Issue
Block a user