mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-24 08:03:19 +00:00
#5037 tightened the standard status bar to 30 px; the Compact Mode e2e still expected 34 px for the normal density.
49 lines
2.1 KiB
TypeScript
49 lines
2.1 KiB
TypeScript
import { expect, test } from "./fixtures";
|
|
|
|
/** Heights IDEA's Islands theme uses in compact mode (`*.compact` keys), against the defaults. */
|
|
const SIZES = {
|
|
normal: { titleBar: 40, treeRow: 24, stripeIcon: 20, statusBar: 30, runButton: 30 },
|
|
compact: { titleBar: 32, treeRow: 22, stripeIcon: 16, statusBar: 24, runButton: 26 },
|
|
};
|
|
|
|
async function measure(page: import("@playwright/test").Page) {
|
|
return page.evaluate(() => {
|
|
const height = (selector: string) => document.querySelector(selector)?.getBoundingClientRect().height ?? null;
|
|
return {
|
|
titleBar: height("header"),
|
|
treeRow: height('[role="tree"][aria-label="Project"] [role="treeitem"]'),
|
|
stripeIcon: height("[data-stripe-button] svg"),
|
|
statusBar: height('footer[aria-label="Status bar"]'),
|
|
runButton: height("[data-run-chooser] + * button"),
|
|
};
|
|
});
|
|
}
|
|
|
|
test("Compact Mode shrinks rows, toolbars, stripes and the status bar like IDEA", async ({ workbench: page }, info) => {
|
|
// Plain-browser mode has no settings backend: set what the toggle action would store.
|
|
const setCompact = (compactMode: boolean) =>
|
|
page.evaluate(async (compactMode) => {
|
|
const projectPath = "/src/platform/project.ts";
|
|
const { useProject } = await import(/* @vite-ignore */ projectPath);
|
|
const settings = useProject.getState().settings;
|
|
useProject.setState({
|
|
settings: {
|
|
...settings,
|
|
appearance: { ...settings?.appearance, theme: "dark", syncWithOs: false, compactMode },
|
|
},
|
|
});
|
|
}, compactMode);
|
|
|
|
await setCompact(false);
|
|
await expect.poll(() => measure(page)).toEqual(SIZES.normal);
|
|
await info.attach("normal", { body: await page.screenshot({ animations: "disabled" }), contentType: "image/png" });
|
|
|
|
await setCompact(true);
|
|
await expect(page.locator("html")).toHaveAttribute("data-compact", "");
|
|
await expect.poll(() => measure(page)).toEqual(SIZES.compact);
|
|
await info.attach("compact", { body: await page.screenshot({ animations: "disabled" }), contentType: "image/png" });
|
|
|
|
await setCompact(false);
|
|
await expect.poll(() => measure(page)).toEqual(SIZES.normal);
|
|
});
|