Files
plainleaf/client/styles/plainleaf_workspace.test.ts
T
wushenghuaandCodex bab4b36fae
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: build Markdown-native task center
Co-Authored-By: Codex <noreply@anthropic.com>
2026-08-12 19:26:10 +08:00

44 lines
1.6 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*\.pl-task-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,
);
});
test("gives the task center a full workspace and mobile viewport", () => {
expect(workspaceStyles).toMatch(
/\.pl-task-surface\s*\{[^}]*grid-template-columns: minmax\(360px, 1fr\) auto;/s,
);
expect(workspaceStyles).toMatch(
/@media only screen and \(max-width: 700px\)[\s\S]*?\.pl-task-surface\s*\{[^}]*height: calc\(100dvh - 62px - env\(safe-area-inset-bottom\)\);[^}]*overflow: hidden;/,
);
expect(workspaceStyles).toMatch(
/\.pl-task-content\s*\{[^}]*min-width: 0;[^}]*min-height: 0;[^}]*overflow: hidden;/s,
);
});