Порівняти коміти

...
3 змінених файлів з 88 додано та 2 видалено

No files matched your search

+65
Переглянути файл
@@ -0,0 +1,65 @@
import { expect, openFromTree, test } from "./fixtures";
test("Switcher keeps the open file list and path visible in a narrow workbench", async ({ workbench: page }) => {
await openFromTree(page, "README.md");
await openFromTree(page, "App.tsx");
await page.keyboard.down("Control");
await page.keyboard.press("Tab");
const switcher = page.getByRole("dialog", { name: "Switcher", exact: true });
const files = switcher.getByRole("listbox", { name: "Open files" });
const tools = switcher.getByRole("listbox", { name: "Tool windows" });
const selected = files.getByRole("option", { selected: true });
await expect(selected).toHaveText("README.md");
expect((await switcher.boundingBox())!.width).toBeLessThan(600);
await page.setViewportSize({ width: 400, height: 500 });
await expect.poll(async () => (await files.boundingBox())!.width).toBeGreaterThan(225);
const footer = switcher.locator("footer");
await expect(footer).toHaveText(/README\.md$/);
await expect(footer).toBeInViewport({ ratio: 1 });
await expect(footer).toHaveCSS("font-size", "12px");
expect(await tools.evaluate((el) => el.scrollWidth - el.clientWidth)).toBeLessThanOrEqual(1);
expect(await files.evaluate((el) => el.scrollWidth - el.clientWidth)).toBeLessThanOrEqual(1);
const structure = tools.getByText("Structure", { exact: true });
expect(await structure.evaluate((el) => el.scrollWidth - el.clientWidth)).toBeLessThanOrEqual(1);
await page.keyboard.press("Tab");
const activeTool = tools.getByRole("option", { selected: true });
await expect(activeTool).toBeInViewport({ ratio: 1 });
const firstTool = await activeTool.getAttribute("aria-posinset");
await page.keyboard.press("PageDown");
await page.keyboard.press("PageDown");
await expect(activeTool).not.toHaveAttribute("aria-posinset", firstTool!);
await expect(activeTool).toBeInViewport({ ratio: 0.98 });
expect(await tools.evaluate((el) => el.scrollTop)).toBeGreaterThan(0);
await page.keyboard.press("Shift+Tab");
await expect(selected).toHaveText("README.md");
await page.keyboard.up("Control");
await expect(switcher).toBeHidden();
await expect(page.getByRole("tab", { name: "README.md", exact: true })).toHaveAttribute("aria-selected", "true");
});
test("Switcher takes up less space when both lists have only a few entries", async ({ workbench: page }) => {
await openFromTree(page, "README.md");
await openFromTree(page, "App.tsx");
await page.evaluate(async () => {
const path = "/src/workbench/contributions.ts";
const { useContributions } = (await import(
/* @vite-ignore */ path
)) as typeof import("../src/workbench/contributions");
useContributions.setState(({ toolWindows }) => ({
toolWindows: new Map([...toolWindows].filter(([id]) => id === "project" || id === "terminal")),
}));
});
await page.keyboard.down("Control");
await page.keyboard.press("Tab");
const switcher = page.getByRole("dialog", { name: "Switcher", exact: true });
const tools = switcher.getByRole("listbox", { name: "Tool windows" });
await expect(tools.getByRole("option")).toHaveCount(2);
await expect.poll(async () => (await switcher.boundingBox())!.height).toBeLessThan(380);
await expect(switcher.locator("footer")).toHaveText(/README\.md$/);
await page.keyboard.press("Escape");
await page.keyboard.up("Control");
});
+21
Переглянути файл
@@ -102,6 +102,20 @@
.locations > * {
flex: 1;
}
.switcher {
min-height: min(350px, 80vh);
}
.switcher .columns {
flex: auto;
height: auto;
max-height: 440px;
}
.switcher .tools {
width: clamp(112px, 32%, 184px);
}
.switcher .footer {
font-size: var(--fs-small);
}
.locationsLink {
flex: none;
display: flex;
@@ -267,6 +281,13 @@
.tools .shortcut {
display: none;
}
.switcher .columns {
--list-inset: var(--space-1);
}
.switcher .columns [role="option"] {
gap: var(--space-1);
padding-inline: var(--space-1);
}
.locationsLink {
margin-inline: var(--space-1);
}
+2 -2
Переглянути файл
@@ -325,9 +325,9 @@ function RecentFilesDialog() {
open
onClose={hideRecentPopup}
restoreFocus={keepFocus}
width={720}
width={switcher ? 560 : 720}
aria-label={title}
className={styles.dialog}
className={clsx(styles.dialog, switcher && styles.switcher)}
>
<header className={styles.header}>
<span className={styles.title}>