fix: Fixed workspace tests having an extra tab, b=(no-bug), c=common, compact-mode, workspaces, tests

This commit is contained in:
mr. m
2025-05-09 19:29:53 +02:00
parent 7df278f7ed
commit 1fc2299801
4 changed files with 20 additions and 16 deletions

View File

@@ -420,14 +420,12 @@ var gZenUIManager = {
clearTimeout(this._toastTimeouts[messageId]);
}
this._toastTimeouts[messageId] = setTimeout(() => {
this.motion
.animate(toast, { opacity: [1, 0], scale: [1, 0.5] }, { duration: 0.2, bounce: 0 })
.then(() => {
toast.remove();
if (this._toastContainer.children.length === 0) {
this._toastContainer.setAttribute('hidden', true);
}
});
this.motion.animate(toast, { opacity: [1, 0], scale: [1, 0.5] }, { duration: 0.2, bounce: 0 }).then(() => {
toast.remove();
if (this._toastContainer.children.length === 0) {
this._toastContainer.setAttribute('hidden', true);
}
});
}, options.timeout || 3000);
},

View File

@@ -560,7 +560,13 @@ var gZenCompactModeManager = {
},
async _onTabOpen(tab, inBackground) {
if (inBackground && this.preference && !this.isSidebarPotentiallyOpen() && this._canShowBackgroundTabToast && !gZenGlanceManager._animating) {
if (
inBackground &&
this.preference &&
!this.isSidebarPotentiallyOpen() &&
this._canShowBackgroundTabToast &&
!gZenGlanceManager._animating
) {
gZenUIManager.showToast('zen-background-tab-opened-toast');
}
},

View File

@@ -21,8 +21,8 @@ add_task(async function test_Check_Creation() {
await ZenWorkspaces.removeWorkspace(ZenWorkspaces.activeWorkspace);
const workspacesAfterRemove = await ZenWorkspaces._workspaces();
ok(workspacesAfterRemove.workspaces.length, 1);
ok(workspacesAfterRemove.workspaces.length === 1, 'One workspace should exist.');
ok(workspacesAfterRemove.workspaces[0].uuid === currentWorkspaceUUID, 'The workspace should be the one we started with.');
ok(gBrowser.tabs.length, 1);
ok(gBrowser.tabs.length === 2, 'There should be one tab.');
BrowserTestUtils.removeTab(gBrowser.selectedTab);
});

View File

@@ -278,9 +278,6 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
}
_initializeEmptyTab() {
if (gZenUIManager.testingEnabled) {
return;
}
this._emptyTab = gBrowser.addTrustedTab('about:blank', { inBackground: true, userContextId: 0, _forZenEmptyTab: true });
}
@@ -1154,16 +1151,19 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
async removeWorkspace(windowID) {
let workspacesData = await this._workspaces();
await this.changeWorkspace(workspacesData.workspaces.find((workspace) => workspace.uuid !== windowID));
this._deleteAllTabsInWorkspace(windowID);
await this.changeWorkspace(workspacesData.workspaces.find((workspace) => workspace.uuid !== windowID));
delete this._lastSelectedWorkspaceTabs[windowID];
await ZenWorkspacesStorage.removeWorkspace(windowID);
// Remove the workspace from the cache
this._workspaceCache.workspaces = this._workspaceCache.workspaces.filter((workspace) => workspace.uuid !== windowID);
await this._propagateWorkspaceData();
await this._updateWorkspacesChangeContextMenu();
this.onWindowResize();
for (let container of document.querySelectorAll(`.zen-workspace-tabs-section[zen-workspace-id="${windowID}"]`)) {
container.remove();
}
this.registerPinnedResizeObserver();
}
isWorkspaceActive(workspace) {