Update editor, workspace, Git services, appearance, and project guides
This commit is contained in:
@@ -111,6 +111,62 @@ try {
|
||||
const url = process.env.SMOKE_URL || "http://127.0.0.1:1420";
|
||||
await page.goto(url);
|
||||
await page.getByText("plugin-tab-workspace", { exact: true }).waitFor();
|
||||
await tab("New tab").waitFor();
|
||||
for (const close of ["button", "middle", "shortcut", "all"]) {
|
||||
const before = await tab("New tab").getAttribute("data-path");
|
||||
if (close === "button") await page.getByRole("button", { name: "Close New tab", exact: true }).click();
|
||||
if (close === "middle") await tab("New tab").click({ button: "middle" });
|
||||
if (close === "shortcut") await page.keyboard.press("Control+w");
|
||||
if (close === "all") {
|
||||
await menu("New tab");
|
||||
await page.getByRole("menuitem", { name: "Close all", exact: true }).click();
|
||||
}
|
||||
await page.waitForFunction(before => {
|
||||
const tabs = document.querySelectorAll('.header [role="tab"]');
|
||||
return tabs.length === 1 && tabs[0].getAttribute("data-path") !== before;
|
||||
}, before);
|
||||
assert.equal(await tab("New tab").getAttribute("aria-selected"), "true");
|
||||
}
|
||||
for (const name of ["a.md", "b.md", "c.md", "note-0.md"]) await openFile(name);
|
||||
await page.getByRole("textbox", { name: "Writing editor", exact: true }).filter({ hasText: "# note-0.md" }).waitFor();
|
||||
for (const width of [880, 1280, 1440]) {
|
||||
await page.setViewportSize({ width, height: 1000 });
|
||||
await settle();
|
||||
for (const theme of ["dark", "light"]) {
|
||||
await page.evaluate(theme => document.documentElement.dataset.theme = theme, theme);
|
||||
const dimensions = await page.locator(".header").evaluate(header => {
|
||||
const bar = header.querySelector('[role="tablist"]');
|
||||
const rows = [...bar.querySelectorAll(".tab")];
|
||||
const plus = header.querySelector('[aria-label="New tab (Ctrl T)"]');
|
||||
const bounds = bar.getBoundingClientRect();
|
||||
return {
|
||||
overflow: bar.scrollWidth - bar.clientWidth,
|
||||
left: bounds.left,
|
||||
navigationRight: header.querySelector(".header-left").getBoundingClientRect().right,
|
||||
tabWidth: Math.min(...rows.map(row => row.getBoundingClientRect().width)),
|
||||
gap: plus.getBoundingClientRect().left - Math.min(bounds.right, rows.at(-1).getBoundingClientRect().right),
|
||||
fits: header.scrollWidth <= header.clientWidth,
|
||||
};
|
||||
});
|
||||
if (width >= 1280) assert.ok(dimensions.overflow <= 1, JSON.stringify(dimensions));
|
||||
assert.ok(Math.abs(dimensions.left - dimensions.navigationRight) <= 2, JSON.stringify(dimensions));
|
||||
assert.ok(dimensions.tabWidth >= 96, JSON.stringify(dimensions));
|
||||
assert.ok(dimensions.gap >= 0 && dimensions.gap <= 8, JSON.stringify(dimensions));
|
||||
assert.ok(dimensions.fits);
|
||||
const plus = page.getByRole("button", { name: "New tab (Ctrl T)", exact: true });
|
||||
await plus.evaluate(button => button.blur());
|
||||
await plus.focus();
|
||||
await page.locator('[role="tooltip"]:popover-open').filter({ hasText: "New tab (Ctrl T)" }).waitFor();
|
||||
await page.keyboard.press("Escape");
|
||||
await mkdir(".audit", { recursive: true });
|
||||
await page.locator(".header").screenshot({ path: `.audit/compact-tabs-${width}-${theme}.png` });
|
||||
}
|
||||
}
|
||||
await menu("note-0.md");
|
||||
await page.getByRole("menuitem", { name: "Close all", exact: true }).click();
|
||||
await tab("New tab").waitFor();
|
||||
assert.deepEqual(await order(), ["New tab"]);
|
||||
console.log("PASS: the last tab becomes a new tab, tabs retain usable widths, and the adjacent plus button has a focus tooltip");
|
||||
await openFile("a.md");
|
||||
await openFile("b.md");
|
||||
await openView("Overview");
|
||||
@@ -232,7 +288,9 @@ try {
|
||||
await settingsPage.close();
|
||||
|
||||
await page.goto(`${url}?no-workspace`);
|
||||
await tab("New tab").waitFor();
|
||||
await openView("Overview");
|
||||
await page.getByRole("button", { name: "Close New tab", exact: true }).click();
|
||||
await openView("Browser");
|
||||
await drag("Browser", "Overview");
|
||||
assert.deepEqual(await order(), ["Browser", "Overview"]);
|
||||
@@ -242,7 +300,8 @@ try {
|
||||
await tab("Browser").click({ button: "middle" });
|
||||
assert.deepEqual(await order(), ["Overview"]);
|
||||
await page.getByRole("button", { name: "Close Overview", exact: true }).click();
|
||||
assert.equal(await page.getByRole("tab").count(), 0);
|
||||
await tab("New tab").waitFor();
|
||||
assert.deepEqual(await order(), ["New tab"]);
|
||||
assert.deepEqual(errors, []);
|
||||
console.log("PASS: plugin tabs reorder and close without an open workspace");
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user