mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-24 08:03:19 +00:00
The Scopes dialog in Find in Files keeps its list scrollable beside the Name and Pattern fields. At narrow widths the editor moves below the list, giving the pattern more room. Long names show an ellipsis and a tooltip, and the selected scope stays visible when a row is added.
60 lines
3.1 KiB
TypeScript
60 lines
3.1 KiB
TypeScript
import { expect, test } from "./fixtures";
|
|
|
|
test("Find in Files keeps the scope list and pattern editor usable in a narrow window", async ({ workbench: page }) => {
|
|
await page.setViewportSize({ width: 1040, height: 700 });
|
|
const longName = "Regional settlement reconciliation sources for month-end audit and publication";
|
|
await page.evaluate(async (longName) => {
|
|
const search = "/src/platform/search.ts";
|
|
const { saveCustomScopes } = await import(/* @vite-ignore */ search);
|
|
saveCustomScopes(
|
|
Array.from({ length: 26 }, (_, i) => ({
|
|
name: i ? `Reconciliation scope ${i + 1}` : longName,
|
|
pattern: i ? `file:src/scope-${i + 1}//*` : "file:src/reconciliation//*",
|
|
})),
|
|
);
|
|
}, longName);
|
|
await page.keyboard.press("Meta+Shift+F");
|
|
const find = page.getByRole("dialog", { name: "Find in Files", exact: true });
|
|
await find.getByRole("tab", { name: "Scope", exact: true }).click();
|
|
const openScopes = find.getByRole("button", { name: "Edit Scopes…", exact: true });
|
|
await openScopes.click();
|
|
|
|
const dialog = page.getByRole("dialog", { name: "Scopes", exact: true });
|
|
const list = dialog.getByRole("list", { name: "Scopes", exact: true });
|
|
const name = dialog.getByRole("textbox", { name: "Name:", exact: true });
|
|
const pattern = dialog.getByRole("textbox", { name: "Pattern:", exact: true });
|
|
await expect(pattern).toHaveValue("file:src/reconciliation//*");
|
|
expect(await list.evaluate((el) => el.scrollHeight - el.clientHeight)).toBeGreaterThan(100);
|
|
await expect(list.getByRole("button", { name: longName })).toHaveAttribute("title", longName);
|
|
expect((await list.boundingBox())!.x).toBeLessThan((await name.boundingBox())!.x);
|
|
|
|
await page.setViewportSize({ width: 460, height: 530 });
|
|
const fields = (await pattern.boundingBox())!;
|
|
expect(fields.y).toBeGreaterThanOrEqual((await list.boundingBox())!.y + (await list.boundingBox())!.height);
|
|
expect(fields.width).toBeGreaterThan(250);
|
|
await list.evaluate((el) => (el.scrollTop = el.scrollHeight));
|
|
expect((await pattern.boundingBox())!.y).toBeCloseTo(fields.y, 0);
|
|
const toolbar = dialog.getByRole("toolbar", { name: "Scopes actions" });
|
|
const add = toolbar.getByRole("button", { name: "Add Scope", exact: true });
|
|
const ok = dialog.getByRole("button", { name: "OK", exact: true });
|
|
await expect(add).toBeInViewport({ ratio: 1 });
|
|
await expect(ok).toBeInViewport({ ratio: 1 });
|
|
|
|
await name.fill("Unsaved selection");
|
|
await dialog.getByRole("button", { name: "Cancel", exact: true }).click();
|
|
await openScopes.click();
|
|
await expect(name).toHaveValue(longName);
|
|
await add.click();
|
|
const draft = list.getByRole("button", { name: "Unnamed", exact: true });
|
|
await expect(draft).toHaveAttribute("aria-current", "true");
|
|
await expect(draft).toBeInViewport({ ratio: 1 });
|
|
await expect(ok).toBeDisabled();
|
|
await name.fill("Release inputs");
|
|
await pattern.fill("file:src/release//*");
|
|
await ok.click();
|
|
await expect(dialog).toBeHidden();
|
|
await openScopes.click();
|
|
await list.getByRole("button", { name: "Release inputs", exact: true }).click();
|
|
await expect(pattern).toHaveValue("file:src/release//*");
|
|
});
|