diff --git a/e2e/statusBarLayout.spec.ts b/e2e/statusBarLayout.spec.ts new file mode 100644 index 000000000..30b1c858d --- /dev/null +++ b/e2e/statusBarLayout.spec.ts @@ -0,0 +1,36 @@ +import { expect, openFromTree, test } from "./fixtures"; + +test("status bar uses its row height and widget insets in both densities", async ({ workbench: page }) => { + const editor = await openFromTree(page, "build.gradle.kts"); + const bar = page.locator('footer[aria-label="Status bar"]'); + const lineEnding = bar.locator('[data-status-item="editor.lineEnding"]'); + const encoding = bar.locator('[data-status-item="editor.encoding"]'); + await expect(lineEnding.getByRole("button")).toBeVisible(); + await expect(encoding.getByRole("button")).toBeVisible(); + await expect(bar).toHaveCSS("height", "30px"); + await expect(encoding.getByRole("button")).toHaveCSS("font-size", "13px"); + + const widgetGap = async () => { + const left = await lineEnding.boundingBox(); + const right = await encoding.boundingBox(); + return right!.x - left!.x - left!.width; + }; + await expect.poll(widgetGap).toBeCloseTo(0, 1); + + await page.locator("html").evaluate((root) => root.setAttribute("data-compact", "")); + await expect(bar).toHaveCSS("height", "24px"); + await expect(encoding.getByRole("button")).toHaveCSS("font-size", "12px"); + await expect.poll(widgetGap).toBeCloseTo(0, 1); + + await editor.locator(".cm-content").press("Meta+a"); + await page.setViewportSize({ width: 400, height: 620 }); + const more = bar.getByRole("button", { name: "Show more" }); + await expect(more).toBeVisible(); + await more.press("Enter"); + const popup = page.getByRole("dialog", { name: "Show more" }); + await expect(popup).toBeInViewport({ ratio: 1 }); + await expect(popup.getByRole("button", { name: /chars/ })).toBeVisible(); + await page.setViewportSize({ width: 1000, height: 620 }); + await expect(popup).toBeHidden(); + await expect(more).toBeHidden(); +}); diff --git a/src/workbench/StatusBar.module.css b/src/workbench/StatusBar.module.css index ccd528070..57536c07a 100644 --- a/src/workbench/StatusBar.module.css +++ b/src/workbench/StatusBar.module.css @@ -1,11 +1,10 @@ /* Islands: the status bar sits on the frame background, no divider. */ .bar { - height: calc(var(--h-statusbar) + 4px); + height: var(--h-statusbar); flex: none; display: flex; align-items: center; - gap: var(--space-1); - padding: 0 10px 0 12px; + padding: 0 10px; font-family: var(--font-ui); font-size: var(--fs-chrome); color: var(--fg-muted); @@ -13,10 +12,6 @@ overflow: hidden; position: relative; } -/* IDEA's compact status bar is just its widgets' height (StatusBar.Widget.widgetInsets 4,8,3,8). */ -:global(:root[data-compact]) .bar { - height: var(--h-statusbar); -} /* Widgets read as plain UI text like IDEA's, whatever their own font. */ .item { font-family: var(--font-ui);