手机端改用抽屉侧栏并移除底部导航,补充 Markdown 编辑工具栏,收拢开发者选项并改善社区扩展下载错误反馈。 Co-Authored-By: Codex <noreply@anthropic.com>
61 lines
2.3 KiB
TypeScript
61 lines
2.3 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).not.toContain("100dvh - 62px");
|
|
expect(workspaceStyles).not.toContain(".pl-mobile-navigation");
|
|
expect(workspaceStyles).toMatch(
|
|
/@media only screen and \(max-width: 700px\)[\s\S]*?\.pl-sidebar\s*\{[^}]*width: min\(82vw, 320px\);/,
|
|
);
|
|
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,
|
|
);
|
|
expect(workspaceStyles).toMatch(
|
|
/\.pl-sidebar-scroll\s*\{[^}]*overflow-x: hidden;[^}]*overflow-y: auto;/s,
|
|
);
|
|
});
|
|
|
|
test("keeps the Markdown toolbar inside the mobile viewport", () => {
|
|
expect(workspaceStyles).toMatch(
|
|
/\.pl-editor-layer\.is-hidden > \.pl-markdown-toolbar\s*\{[^}]*pointer-events: none;/s,
|
|
);
|
|
expect(workspaceStyles).toMatch(
|
|
/\.pl-markdown-toolbar\s*\{[^}]*min-width: 0;[^}]*overflow-x: auto;[^}]*overflow-y: hidden;/s,
|
|
);
|
|
expect(workspaceStyles).toMatch(
|
|
/@media only screen and \(max-width: 700px\)[\s\S]*?\.pl-markdown-toolbar\s*\{[^}]*height: 44px;/,
|
|
);
|
|
});
|
|
|
|
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: 100dvh;[^}]*overflow: hidden;/,
|
|
);
|
|
expect(workspaceStyles).toMatch(
|
|
/\.pl-task-content\s*\{[^}]*min-width: 0;[^}]*min-height: 0;[^}]*overflow: hidden;/s,
|
|
);
|
|
});
|