Files
plainleaf/client/styles/plainleaf_workspace.test.ts
T
wushenghua ea716b2628
CI / config (push) Canceled after 0s
CI / test-frontend (push) Canceled after 0s
CI / test-rust (push) Canceled after 0s
CI / test-e2e (push) Canceled after 0s
CI / test-e2e-release (push) Canceled after 0s
CI / build (push) Canceled after 0s
CI / release (push) Canceled after 0s
CI / docker (push) Canceled after 0s
CI / docker-website (push) Canceled after 0s
feat: localize config and fix mobile viewport
2026-08-12 18:43:33 +08:00

32 lines
1.0 KiB
TypeScript

import { readFileSync } from "node:fs";
import { expect, test } from "vitest";
const workspaceStyles = readFileSync(
new URL("./plainleaf_workspace.scss", import.meta.url),
"utf8",
);
const clientHtml = readFileSync(
new URL("../html/index.html", import.meta.url),
"utf8",
);
test("keeps mobile workspace within the dynamic viewport", () => {
expect(workspaceStyles).toContain("height: 100dvh;");
expect(workspaceStyles).toContain(
"height: calc(100dvh - 62px - env(safe-area-inset-bottom));",
);
expect(clientHtml).toContain("viewport-fit=cover");
});
test("uses internal vertical scrolling without widening the page", () => {
expect(workspaceStyles).toMatch(
/\.pl-home-surface,\s*\.pl-settings-surface\s*\{[^}]*overflow-x: hidden;[^}]*overflow-y: auto;/s,
);
expect(workspaceStyles).toMatch(
/\.pl-home-inner\s*\{[^}]*box-sizing: border-box;[^}]*max-width: 100%;/s,
);
expect(workspaceStyles).toMatch(
/\.pl-settings-inner\s*\{[^}]*box-sizing: border-box;[^}]*max-width: 100%;/s,
);
});