mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-24 16:04:21 +00:00
With the overlay title bar, macOS draws the window buttons over the page, so a tall dialog (e.g. Push) or one dragged to the top edge had its title bar covered. The dialog layer now keeps a top margin of at least the title bar height on macOS, and dragging stops there. Windows and Linux are unchanged. Co-authored-by: EjaYF <9842286+EjaYF@users.noreply.github.com>
29 lines
1.3 KiB
TypeScript
29 lines
1.3 KiB
TypeScript
import { test, expect, type Page } from "@playwright/test";
|
|
|
|
async function titleBarHeight(page: Page) {
|
|
return page.evaluate(() => parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--h-titlebar")));
|
|
}
|
|
|
|
// Reduced motion skips the opening animation, which scales the dialog while it runs.
|
|
test.use({ viewport: { width: 1200, height: 640 }, reducedMotion: "reduce" });
|
|
|
|
test("a dialog taller than the window stays below the macOS window buttons", async ({ page }) => {
|
|
await page.goto("/e2e/dialogTitleBar.html");
|
|
const dialog = page.getByRole("dialog");
|
|
await expect(dialog).toBeVisible();
|
|
const box = (await dialog.boundingBox())!;
|
|
expect(box.y).toBeGreaterThanOrEqual(await titleBarHeight(page));
|
|
});
|
|
|
|
test("dragging a dialog up stops below the macOS window buttons", async ({ page }) => {
|
|
await page.goto("/e2e/dialogTitleBar.html");
|
|
const title = page.getByRole("dialog").locator("[data-dialog-titlebar] span").last();
|
|
const start = (await title.boundingBox())!;
|
|
await page.mouse.move(start.x + 40, start.y + start.height / 2);
|
|
await page.mouse.down();
|
|
await page.mouse.move(start.x + 40, 0, { steps: 8 });
|
|
await page.mouse.up();
|
|
const box = (await page.getByRole("dialog").boundingBox())!;
|
|
expect(box.y).toBeGreaterThanOrEqual(await titleBarHeight(page));
|
|
});
|