chore: Added some tests for container specific essentials, b=(no-bug), c=tests, workspaces

This commit is contained in:
Mr. M
2025-05-10 00:20:09 +02:00
parent 3e53787a62
commit 6a21a6fdb1
3 changed files with 45 additions and 5 deletions

View File

@@ -2437,12 +2437,13 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
}
}
_createWorkspaceData(name, icon, tabs, moveTabs = true) {
_createWorkspaceData(name, icon, tabs, moveTabs = true, containerTabId = 0) {
let window = {
uuid: gZenUIManager.generateUuidv4(),
icon: icon,
name: name,
theme: ZenThemePicker.getTheme([]),
containerTabId,
};
if (moveTabs) {
this._prepareNewWorkspace(window);
@@ -2454,15 +2455,19 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
return window;
}
async createAndSaveWorkspace(name = 'Space', icon = undefined, dontChange = false) {
async createAndSaveWorkspace(name = 'Space', icon = undefined, dontChange = false, containerTabId = 0) {
if (!this.workspaceEnabled) {
return;
}
// get extra tabs remaning (e.g. on new profiles) and just move them to the new workspace
const extraTabs = Array.from(gBrowser.tabContainer.arrowScrollbox.children).filter(
(child) => child.tagName === 'tab' && !child.hasAttribute('zen-workspace-id')
(child) =>
child.tagName === 'tab' &&
!child.hasAttribute('zen-workspace-id') &&
!child.hasAttribute('zen-empty-tab') &&
!child.hasAttribute('zen-essential')
);
let workspaceData = this._createWorkspaceData(name, icon, extraTabs, !dontChange);
let workspaceData = this._createWorkspaceData(name, icon, extraTabs, !dontChange, containerTabId);
await this.saveWorkspace(workspaceData, dontChange);
if (!dontChange) {
this.registerPinnedResizeObserver();