mirror of
https://github.com/zen-browser/desktop.git
synced 2026-08-24 15:31:34 +00:00
chore: Run lint and fund dependencies, p=#12718
This commit is contained in:
@@ -19,7 +19,8 @@ add_task(async function test_Basic_Split_View() {
|
||||
add_task(async function test_Browser_Elements_Attributes() {
|
||||
await basicSplitNTabs(() => {
|
||||
Assert.equal(
|
||||
document.querySelectorAll('.browserSidebarContainer[zen-split="true"]').length,
|
||||
document.querySelectorAll('.browserSidebarContainer[zen-split="true"]')
|
||||
.length,
|
||||
2,
|
||||
"There should be two split browser sidebars"
|
||||
);
|
||||
|
||||
@@ -17,20 +17,29 @@ add_task(async function test_Basic_Split_View_Duplication() {
|
||||
"There should be four tabs after pinning the second tab"
|
||||
);
|
||||
await createSplitView([normal, pinned], "grid");
|
||||
ok(!pinned.group, "The pinned tab should not be in a split group after duplication");
|
||||
ok(
|
||||
!pinned.group,
|
||||
"The pinned tab should not be in a split group after duplication"
|
||||
);
|
||||
ok(
|
||||
normal.group.hasAttribute("split-view-group"),
|
||||
"The normal tab should be in a split group after duplication"
|
||||
);
|
||||
const group = normal.group;
|
||||
for (const tab of group.tabs) {
|
||||
Assert.ok(!tab.pinned, "All tabs in the split group should not be pinned after duplication");
|
||||
Assert.ok(
|
||||
!tab.pinned,
|
||||
"All tabs in the split group should not be pinned after duplication"
|
||||
);
|
||||
Assert.ok(
|
||||
tab.splitView,
|
||||
"All tabs in the split group should be in a split view after duplication"
|
||||
);
|
||||
}
|
||||
Assert.ok(!group.pinned, "The split group should not be pinned after duplication");
|
||||
Assert.ok(
|
||||
!group.pinned,
|
||||
"The split group should not be pinned after duplication"
|
||||
);
|
||||
for (const tab of [pinned, ...group.tabs]) {
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
}
|
||||
@@ -46,9 +55,16 @@ add_task(async function test_Split_View_Duplication_Both_Pinned() {
|
||||
gBrowser.pinTab(tab1);
|
||||
gBrowser.pinTab(tab2);
|
||||
await Promise.all([pinEvent1, pinEvent2]);
|
||||
Assert.strictEqual(gBrowser.tabs.length, 4, "There should be four tabs after pinning both tabs");
|
||||
Assert.strictEqual(
|
||||
gBrowser.tabs.length,
|
||||
4,
|
||||
"There should be four tabs after pinning both tabs"
|
||||
);
|
||||
await createSplitView([tab1, tab2], "grid");
|
||||
ok(tab1.group, "The first pinned tab should be in a split group after duplication");
|
||||
ok(
|
||||
tab1.group,
|
||||
"The first pinned tab should be in a split group after duplication"
|
||||
);
|
||||
Assert.strictEqual(
|
||||
tab2.group,
|
||||
tab1.group,
|
||||
@@ -60,13 +76,19 @@ add_task(async function test_Split_View_Duplication_Both_Pinned() {
|
||||
"There should not be any duplicate tabs after pinning both tabs"
|
||||
);
|
||||
for (const tab of tab1.group.tabs) {
|
||||
Assert.ok(tab.pinned, "All tabs in the split group should be pinned after duplication");
|
||||
Assert.ok(
|
||||
tab.pinned,
|
||||
"All tabs in the split group should be pinned after duplication"
|
||||
);
|
||||
Assert.ok(
|
||||
tab.splitView,
|
||||
"All tabs in the split group should be in a split view after duplication"
|
||||
);
|
||||
}
|
||||
Assert.ok(tab1.group.pinned, "The split group should be pinned after duplication of both tabs");
|
||||
Assert.ok(
|
||||
tab1.group.pinned,
|
||||
"The split group should be pinned after duplication of both tabs"
|
||||
);
|
||||
for (const tab of tab1.group.tabs) {
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
}
|
||||
@@ -116,7 +138,7 @@ add_task(async function test_Split_View_Duplication_Essential() {
|
||||
const essentials = await Promise.all(
|
||||
[...Array(2)].map((_, i) => addTabTo(gBrowser, getUrlForNthTab(i + 1)))
|
||||
);
|
||||
essentials.forEach((tab) => {
|
||||
essentials.forEach(tab => {
|
||||
gZenPinnedTabManager.addToEssentials(tab);
|
||||
});
|
||||
Assert.strictEqual(
|
||||
@@ -131,8 +153,14 @@ add_task(async function test_Split_View_Duplication_Essential() {
|
||||
"There should be six tabs after creating a split view with two essential tabs"
|
||||
);
|
||||
for (const tab of essentials) {
|
||||
ok(!tab.group, "Each essential tab should not be in a split group after duplication");
|
||||
ok(!tab.splitView, "Each essential tab should not be in a split view after duplication");
|
||||
ok(
|
||||
!tab.group,
|
||||
"Each essential tab should not be in a split group after duplication"
|
||||
);
|
||||
ok(
|
||||
!tab.splitView,
|
||||
"Each essential tab should not be in a split view after duplication"
|
||||
);
|
||||
}
|
||||
for (const tab of gBrowser.tabs) {
|
||||
if (existingTabs.includes(tab)) {
|
||||
|
||||
@@ -4,21 +4,34 @@
|
||||
"use strict";
|
||||
|
||||
add_task(async function test_Basic_Split_Groups() {
|
||||
await basicSplitNTabs(async (tabs) => {
|
||||
ok(tabs[0].group.hasAttribute("split-view-group"), "The first tab should be in a split group");
|
||||
Assert.equal(tabs[0].group.tabs.length, 2, "The first split group should contain two tabs");
|
||||
await basicSplitNTabs(async tabs => {
|
||||
ok(
|
||||
tabs[0].group.hasAttribute("split-view-group"),
|
||||
"The first tab should be in a split group"
|
||||
);
|
||||
Assert.equal(
|
||||
tabs[0].group.tabs.length,
|
||||
2,
|
||||
"The first split group should contain two tabs"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
add_task(async function test_Basic_Split_Groups_Pinning() {
|
||||
await basicSplitNTabs(async (tabs) => {
|
||||
await basicSplitNTabs(async tabs => {
|
||||
const group = tabs[0].group;
|
||||
ok(group.hasAttribute("split-view-group"), "The first tab should be in a split group");
|
||||
ok(
|
||||
group.hasAttribute("split-view-group"),
|
||||
"The first tab should be in a split group"
|
||||
);
|
||||
const pinEvent = BrowserTestUtils.waitForEvent(tabs[0], "TabPinned");
|
||||
gBrowser.pinTab(tabs[0]);
|
||||
await pinEvent;
|
||||
for (const tab of tabs) {
|
||||
ok(tab.pinned, "All tabs in the split group should be pinned after pinning the first tab");
|
||||
ok(
|
||||
tab.pinned,
|
||||
"All tabs in the split group should be pinned after pinning the first tab"
|
||||
);
|
||||
Assert.strictEqual(
|
||||
tab.group,
|
||||
group,
|
||||
@@ -40,15 +53,21 @@ add_task(async function test_Basic_Split_Groups_Pinning() {
|
||||
"All tabs in the split group should remain in the same group after unpinning"
|
||||
);
|
||||
}
|
||||
ok(!group.pinned, "The split group should be unpinned after unpinning a tab");
|
||||
ok(
|
||||
!group.pinned,
|
||||
"The split group should be unpinned after unpinning a tab"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
add_task(async function test_Basic_Unsplit_Group_Removed() {
|
||||
let group;
|
||||
await basicSplitNTabs(async (tabs) => {
|
||||
await basicSplitNTabs(async tabs => {
|
||||
group = tabs[0].group;
|
||||
});
|
||||
ok(group, "The split group should exist");
|
||||
ok(!group.parentNode, "The split group should be removed from the DOM after unsplitting");
|
||||
ok(
|
||||
!group.parentNode,
|
||||
"The split group should be removed from the DOM after unsplitting"
|
||||
);
|
||||
});
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
add_task(async function test_Basic_Split_View_Inset() {
|
||||
let viewsToCheck = [];
|
||||
await basicSplitNTabs(() => {
|
||||
viewsToCheck = document.querySelectorAll('.browserSidebarContainer[zen-split="true"]');
|
||||
viewsToCheck = document.querySelectorAll(
|
||||
'.browserSidebarContainer[zen-split="true"]'
|
||||
);
|
||||
ok(viewsToCheck.length, "There should be split views present");
|
||||
Assert.equal(
|
||||
viewsToCheck[0].style.inset,
|
||||
@@ -20,13 +22,19 @@ add_task(async function test_Basic_Split_View_Inset() {
|
||||
);
|
||||
});
|
||||
for (const view of viewsToCheck) {
|
||||
Assert.equal(view.style.inset, "", "The unsplit view should not have correct inset style");
|
||||
Assert.equal(
|
||||
view.style.inset,
|
||||
"",
|
||||
"The unsplit view should not have correct inset style"
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
add_task(async function test_Horizontal_Split_Inset() {
|
||||
await basicSplitNTabs(() => {
|
||||
const viewsToCheck = document.querySelectorAll('.browserSidebarContainer[zen-split="true"]');
|
||||
const viewsToCheck = document.querySelectorAll(
|
||||
'.browserSidebarContainer[zen-split="true"]'
|
||||
);
|
||||
ok(viewsToCheck.length, "There should be split views present");
|
||||
Assert.equal(
|
||||
viewsToCheck[0].style.inset,
|
||||
@@ -44,7 +52,9 @@ add_task(async function test_Horizontal_Split_Inset() {
|
||||
add_task(async function test_3_Splits_Grid_Inset() {
|
||||
await basicSplitNTabs(
|
||||
() => {
|
||||
const viewsToCheck = document.querySelectorAll('.browserSidebarContainer[zen-split="true"]');
|
||||
const viewsToCheck = document.querySelectorAll(
|
||||
'.browserSidebarContainer[zen-split="true"]'
|
||||
);
|
||||
ok(viewsToCheck.length, "There should be split views present");
|
||||
Assert.equal(
|
||||
viewsToCheck[0].style.inset,
|
||||
|
||||
@@ -25,7 +25,7 @@ add_task(async function test_Split_View_Empty() {
|
||||
let result = await UrlbarTestUtils.getDetailsOfResultAt(window, 0);
|
||||
EventUtils.synthesizeMouseAtCenter(result.element.row, {});
|
||||
await waitForActivationPromise;
|
||||
await new Promise((resolve) => {
|
||||
await new Promise(resolve => {
|
||||
/* eslint-disable mozilla/no-arbitrary-setTimeout */
|
||||
setTimeout(async () => {
|
||||
resolve();
|
||||
@@ -36,8 +36,14 @@ add_task(async function test_Split_View_Empty() {
|
||||
gBrowser.tabpanels.hasAttribute("zen-split-view"),
|
||||
"The split view should not have crashed with two tabs in it"
|
||||
);
|
||||
ok(!gZenWorkspaces._emptyTab.splitView, "The empty tab should not be in split view");
|
||||
ok(!gZenWorkspaces._emptyTab.group, "The empty tab should not be in a group");
|
||||
ok(
|
||||
!gZenWorkspaces._emptyTab.splitView,
|
||||
"The empty tab should not be in split view"
|
||||
);
|
||||
ok(
|
||||
!gZenWorkspaces._emptyTab.group,
|
||||
"The empty tab should not be in a group"
|
||||
);
|
||||
ok(selectedTab.splitView, "The selected tab should be in split view");
|
||||
ok(originalTab.splitView, "The original tab should be in split view");
|
||||
Assert.equal(
|
||||
|
||||
@@ -13,13 +13,25 @@ add_task(async function test_Split_View_Inside_Folder() {
|
||||
gBrowser.pinTab(tab1);
|
||||
gBrowser.pinTab(tab2);
|
||||
await Promise.all([pinEvent1, pinEvent2]);
|
||||
Assert.strictEqual(gBrowser.tabs.length, 4, "There should be four tabs after pinning both tabs");
|
||||
Assert.strictEqual(
|
||||
gBrowser.tabs.length,
|
||||
4,
|
||||
"There should be four tabs after pinning both tabs"
|
||||
);
|
||||
const folder = await gZenFolders.createFolder([tab1, tab2], {
|
||||
renameFolder: false,
|
||||
label: "test",
|
||||
});
|
||||
Assert.equal(tab1.group, folder, "The first pinned tab should be in the folder group");
|
||||
Assert.equal(tab2.group, folder, "The second pinned tab should be in the folder group");
|
||||
Assert.equal(
|
||||
tab1.group,
|
||||
folder,
|
||||
"The first pinned tab should be in the folder group"
|
||||
);
|
||||
Assert.equal(
|
||||
tab2.group,
|
||||
folder,
|
||||
"The second pinned tab should be in the folder group"
|
||||
);
|
||||
await createSplitView([tab1, tab2], "grid");
|
||||
Assert.strictEqual(
|
||||
tab2.group,
|
||||
@@ -30,8 +42,15 @@ add_task(async function test_Split_View_Inside_Folder() {
|
||||
tab1.group.hasAttribute("split-view-group"),
|
||||
"The first pinned tab should be in a split group after duplication"
|
||||
);
|
||||
Assert.ok(tab1.group.pinned, "The split group should be pinned after duplication of both tabs");
|
||||
Assert.equal(tab1.group.group, folder, "The split group should be the folder after duplication");
|
||||
Assert.ok(
|
||||
tab1.group.pinned,
|
||||
"The split group should be pinned after duplication of both tabs"
|
||||
);
|
||||
Assert.equal(
|
||||
tab1.group.group,
|
||||
folder,
|
||||
"The split group should be the folder after duplication"
|
||||
);
|
||||
const removeEvent = BrowserTestUtils.waitForEvent(window, "TabGroupRemoved");
|
||||
folder.delete();
|
||||
await removeEvent;
|
||||
|
||||
@@ -9,7 +9,7 @@ const { openGlanceOnTab } = ChromeUtils.importESModule(
|
||||
|
||||
add_task(async function test_Basic_Split_View_Glance() {
|
||||
await basicSplitNTabs(async () => {
|
||||
await openGlanceOnTab(window, async (glanceTab) => {
|
||||
await openGlanceOnTab(window, async glanceTab => {
|
||||
ok(
|
||||
glanceTab.hasAttribute("zen-glance-tab"),
|
||||
"The glance tab should have the zen-glance-tab attribute"
|
||||
@@ -23,23 +23,28 @@ add_task(async function test_Basic_Split_View_Glance() {
|
||||
});
|
||||
|
||||
add_task(async function test_Basic_Split_View_Glance_Expand() {
|
||||
await basicSplitNTabs(async (tabs) => {
|
||||
await basicSplitNTabs(async tabs => {
|
||||
await openGlanceOnTab(
|
||||
window,
|
||||
async (glanceTab) => {
|
||||
async glanceTab => {
|
||||
await gZenGlanceManager.fullyOpenGlance();
|
||||
ok(
|
||||
!glanceTab.hasAttribute("zen-glance-tab"),
|
||||
"The glance tab should not have the zen-glance-tab attribute after expanding"
|
||||
);
|
||||
ok(!glanceTab.group, "The glance tab should not be in a split group after expanding");
|
||||
ok(
|
||||
!glanceTab.group,
|
||||
"The glance tab should not be in a split group after expanding"
|
||||
);
|
||||
for (const tab of tabs) {
|
||||
ok(
|
||||
tab.group.hasAttribute("split-view-group"),
|
||||
"All tabs in the split view should still be in a split group after expanding glance"
|
||||
);
|
||||
}
|
||||
const selectedBrowser = document.querySelectorAll(".browserSidebarContainer.deck-selected");
|
||||
const selectedBrowser = document.querySelectorAll(
|
||||
".browserSidebarContainer.deck-selected"
|
||||
);
|
||||
Assert.equal(
|
||||
selectedBrowser.length,
|
||||
1,
|
||||
@@ -57,7 +62,9 @@ add_task(async function test_Basic_Split_View_Glance_No_More_Split() {
|
||||
async () => {
|
||||
await openGlanceOnTab(window, () => {
|
||||
Assert.strictEqual(
|
||||
document.getElementById("cmd_zenGlanceSplit").getAttribute("disabled"),
|
||||
document
|
||||
.getElementById("cmd_zenGlanceSplit")
|
||||
.getAttribute("disabled"),
|
||||
"true",
|
||||
"The split command should be disabled when glance is open"
|
||||
);
|
||||
@@ -73,7 +80,7 @@ add_task(async function test_Basic_Split_View_Glance_Split() {
|
||||
gBrowser.selectedTab = tab;
|
||||
await openGlanceOnTab(
|
||||
window,
|
||||
async (glanceTab) => {
|
||||
async glanceTab => {
|
||||
const waitForSplitPromise = BrowserTestUtils.waitForEvent(
|
||||
window,
|
||||
"ZenViewSplitter:SplitViewActivated"
|
||||
|
||||
@@ -3,7 +3,11 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
async function addTabTo(targetBrowser, url = "http://mochi.test:8888/", params = {}) {
|
||||
async function addTabTo(
|
||||
targetBrowser,
|
||||
url = "http://mochi.test:8888/",
|
||||
params = {}
|
||||
) {
|
||||
params.skipAnimation = true;
|
||||
const tab = BrowserTestUtils.addTab(targetBrowser, url, params);
|
||||
const browser = targetBrowser.getBrowserForTab(tab);
|
||||
@@ -22,7 +26,7 @@ async function createSplitView(tabs, type = "grid") {
|
||||
);
|
||||
gZenViewSplitter.splitTabs(tabs, type);
|
||||
await waitForActivationPromise;
|
||||
await new Promise((resolve) => {
|
||||
await new Promise(resolve => {
|
||||
setTimeout(async () => {
|
||||
resolve();
|
||||
}, 100);
|
||||
|
||||
Reference in New Issue
Block a user