дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-04 01:01:17 +02:00
Main toolbar items get a 10px pitch and the dropdowns 10/6px insets with a 16px chevron; stripe buttons get 5px padding on both sides; the status bar is 34px with 4px widget hover insets, its breadcrumbs lifted 5px, and the islands keep a 3px inset above it. Language Services moves after the caret position in the status bar. Compact mode keeps its previous metrics. Fixed-viewport e2e layouts (commit checks, project tree second click, main toolbar label compression next to the New Agent Task button) get room for the wider gaps and the taller status bar. Co-authored-by: wildcatDownstairs <[email protected]>
111 рядки
4.9 KiB
TypeScript
111 рядки
4.9 KiB
TypeScript
import { expect, stubDesktop, test } from "./fixtures";
|
|
|
|
const projectName = "Regional Order Fulfillment and Payments";
|
|
const runName = "Fulfillment Integration Checkout Suite";
|
|
|
|
test("the main toolbar compresses long labels before a short branch name", async ({ workbench: page }) => {
|
|
await stubDesktop(page);
|
|
await page.evaluate(
|
|
async ({ projectName, runName }) => {
|
|
const platform = "/src/platform/platformInfo.ts";
|
|
const project = "/src/platform/project.ts";
|
|
const vcs = "/src/features/vcs/store.ts";
|
|
const run = "/src/features/run/store.ts";
|
|
const { usePlatform } = await import(/* @vite-ignore */ platform);
|
|
const { useProject } = await import(/* @vite-ignore */ project);
|
|
const { useVcs } = await import(/* @vite-ignore */ vcs);
|
|
const { useRun } = await import(/* @vite-ignore */ run);
|
|
usePlatform.setState({ os: "windows", framelessTitleBar: true, overlayTitleBar: false });
|
|
useProject.setState({ project: { ...useProject.getState().project, displayName: projectName } });
|
|
useVcs.setState({
|
|
available: true,
|
|
branch: { head: "main", headCommit: "a".repeat(40), upstream: null, ahead: 0, behind: 0, operation: null },
|
|
});
|
|
useRun.setState({
|
|
loaded: true,
|
|
selectedId: "test",
|
|
configs: [
|
|
{
|
|
id: "test",
|
|
name: runName,
|
|
kind: "shell",
|
|
command: "node",
|
|
args: [],
|
|
cwd: null,
|
|
env: {},
|
|
detected: false,
|
|
isTest: false,
|
|
debugAdapter: null,
|
|
},
|
|
],
|
|
});
|
|
},
|
|
{ projectName, runName },
|
|
);
|
|
|
|
const toolbar = page.locator("header").first();
|
|
const project = toolbar.getByText(projectName, { exact: true });
|
|
const branch = toolbar.getByText("main", { exact: true });
|
|
const run = toolbar.getByText(runName, { exact: true });
|
|
const width = (label: typeof project) =>
|
|
label.evaluate((element) => ({ shown: element.clientWidth, preferred: element.scrollWidth }));
|
|
const labels = [project, branch, run];
|
|
|
|
await page.setViewportSize({ width: 1150, height: 620 });
|
|
const expanded = await Promise.all(labels.map(width));
|
|
// 868: IDEA's 10px item gaps (MainToolbar.Icon.insets 6,5,4,5) take 48px more than 4px gaps
|
|
// would, so the bar needs that much more for the two long labels to shrink while the branch stays whole.
|
|
await page.setViewportSize({ width: 868, height: 620 });
|
|
// The label cap is applied in a ResizeObserver's animation frame, so wait until both long labels shrank.
|
|
await expect
|
|
.poll(async () => (await Promise.all([width(project), width(run)])).every((w) => w.shown < w.preferred))
|
|
.toBe(true);
|
|
await expect.poll(async () => (await width(branch)).shown).toBe((await width(branch)).preferred);
|
|
const narrowed = await Promise.all([width(project), width(run)]);
|
|
for (const { shown, preferred } of narrowed) {
|
|
expect(shown).toBeGreaterThan(35);
|
|
expect(shown).toBeLessThan(preferred);
|
|
}
|
|
expect(Math.abs(narrowed[0]!.shown - narrowed[1]!.shown)).toBeLessThanOrEqual(2);
|
|
|
|
// The old 690px width: too narrow for every label, so the branch shrinks as well, but never below the long
|
|
// labels' equal share.
|
|
await page.setViewportSize({ width: 690, height: 620 });
|
|
await expect.poll(async () => (await width(branch)).shown).toBeLessThan((await width(branch)).preferred);
|
|
const squeezed = await Promise.all(labels.map(width));
|
|
expect(squeezed[1]!.shown).toBeGreaterThanOrEqual(Math.min(squeezed[0]!.shown, squeezed[2]!.shown) - 1);
|
|
|
|
await page.setViewportSize({ width: 400, height: 550 });
|
|
const buttons = toolbar.locator("button:visible");
|
|
await expect
|
|
.poll(async () =>
|
|
buttons.evaluateAll((elements) => {
|
|
const bounds = elements
|
|
.filter((element) => getComputedStyle(element).visibility === "visible")
|
|
.map((element) => ({
|
|
label: element.getAttribute("aria-label") ?? element.textContent,
|
|
rect: element.getBoundingClientRect(),
|
|
}))
|
|
.filter(({ rect }) => rect.width > 0)
|
|
.sort((a, b) => a.rect.left - b.rect.left);
|
|
return bounds
|
|
.filter(
|
|
({ rect }, i) =>
|
|
rect.left < 0 || rect.right > innerWidth || rect.left < (bounds[i - 1]?.rect.right ?? 0) - 1,
|
|
)
|
|
.map(({ label, rect }) => [label, rect.left, rect.right]);
|
|
}),
|
|
)
|
|
.toEqual([]);
|
|
await expect.poll(async () => (await Promise.all(labels.map(width))).map(({ shown }) => shown)).toEqual([0, 0, 0]);
|
|
|
|
const chooser = toolbar.locator("[data-run-chooser]");
|
|
await chooser.press("Enter");
|
|
const configs = page.getByRole("dialog", { name: "Run/Debug Configurations" });
|
|
await expect(configs.getByRole("option", { name: new RegExp(`^${runName}`), selected: true })).toBeVisible();
|
|
await page.keyboard.press("Escape");
|
|
|
|
await page.setViewportSize({ width: 1150, height: 620 });
|
|
await expect.poll(() => Promise.all(labels.map(width))).toEqual(expanded);
|
|
});
|