дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-04 01:01:17 +02:00
The Open Project prompt was sized for its four actions only for the local Attach variant, so the remote variant wrapped its buttons. It is now sized for all four actions when New Tab is available, keeping responsive wrapping in narrow windows and the existing button order and default.
37 рядки
2.1 KiB
TypeScript
37 рядки
2.1 KiB
TypeScript
import { expect, test } from "./fixtures";
|
|
|
|
for (const [locale, title, labels] of [
|
|
["en", "Open Project", ["Cancel", "New Tab", "New Window", "This Window"]],
|
|
["fr", "Ouvrir un projet", ["Annuler", "Nouvel onglet", "Nouvelle fenêtre", "Cette fenêtre"]],
|
|
] as const) {
|
|
test(`the remote Open Project prompt keeps its four actions on one row (${locale})`, async ({ workbench: page }) => {
|
|
await page.evaluate(async (locale) => {
|
|
const localeModule = "/src/platform/i18n.ts";
|
|
await (await import(/* @vite-ignore */ localeModule)).setLocale(locale);
|
|
const projectModule = "/src/platform/project.ts";
|
|
const { useProject } = await import(/* @vite-ignore */ projectModule);
|
|
const { settings } = useProject.getState();
|
|
useProject.setState({ settings: { ...settings, general: { ...settings?.general, openProjectIn: "ask" } } });
|
|
const windows = "/src/workbench/projectWindow.ts";
|
|
void (await import(/* @vite-ignore */ windows)).chooseProjectWindow("tauri", false);
|
|
}, locale);
|
|
|
|
const dialog = page.getByRole("dialog", { name: title, exact: true });
|
|
const buttons = dialog.getByRole("button");
|
|
await expect(buttons).toHaveText([...labels]);
|
|
await expect(dialog.getByRole("button", { name: labels[3] })).toBeFocused();
|
|
await page.evaluate(() => document.fonts.ready);
|
|
await page.screenshot({ path: test.info().outputPath("remote-open-project.png"), animations: "disabled" });
|
|
const rows = await buttons.evaluateAll((nodes) => nodes.map((node) => node.getBoundingClientRect().top));
|
|
expect(Math.max(...rows) - Math.min(...rows)).toBeLessThanOrEqual(1);
|
|
|
|
// Keep the existing wrapping behavior in smaller windows rather than clipping actions.
|
|
await page.setViewportSize({ width: 420, height: 455 });
|
|
for (const button of await buttons.all()) await expect(button).toBeInViewport({ ratio: 1 });
|
|
const footer = dialog.locator("[data-dialog-footer]");
|
|
expect(await footer.evaluate((el) => el.scrollWidth - el.clientWidth)).toBeLessThanOrEqual(1);
|
|
await page.keyboard.press("Escape");
|
|
await expect(dialog).toBeHidden();
|
|
});
|
|
}
|