gabriel / musehub public
layout-sidebar.test.ts typescript
47 lines 1.7 KB
Raw
sha256:34035d72cef530c1ab9d6a6f53be18d803dde705fc3157617d70352a96d0747b Merge branch 'fix/wire-push-external-parent-manifest' into dev Human 8 days ago
1 import { describe, it, expect, beforeAll } from "vitest";
2 import { execSync } from "node:child_process";
3 import { readFileSync } from "node:fs";
4 import path from "node:path";
5 import { fileURLToPath } from "node:url";
6
7 const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
8 const appCssPath = path.join(root, "musehub/templates/musehub/static/app.css");
9
10 function compiledCss(): string {
11 return readFileSync(appCssPath, "utf8");
12 }
13
14 describe("layout sidebar compiled CSS (musehub#84)", () => {
15 beforeAll(() => {
16 execSync("npm run build:css", { cwd: root, stdio: "pipe" });
17 });
18
19 it("SIDEBAR_06: app.css contains no 100vh", () => {
20 expect(compiledCss()).not.toMatch(/100vh/);
21 });
22
23 it("SIDEBAR_06: app.css uses 100dvh for viewport-bound panels", () => {
24 expect(compiledCss()).toMatch(/100dvh/);
25 });
26
27 it("SIDEBAR_01: layout-two-col utility includes min-height:0", () => {
28 expect(compiledCss()).toMatch(/\.layout-two-col\{[^}]*min-height:0/);
29 });
30
31 it("SIDEBAR_02: layout-sidebar utility scrolls independently of its own bounded height", () => {
32 const css = compiledCss();
33 expect(css).toMatch(/\.layout-sidebar\{[^}]*min-height:0/);
34 expect(css).toMatch(/\.layout-sidebar\{[^}]*overflow-y:auto/);
35 });
36
37 it("SIDEBAR_03: layout-two-col resets to auto height below 900px", () => {
38 expect(compiledCss()).toMatch(
39 /@media\s*\(max-width:\s*900px\)\s*\{[^}]*\.layout-two-col\{[^}]*height:auto/,
40 );
41 });
42
43 it("SIDEBAR_05: bounded-height columns use --sticky-offset with header fallback", () => {
44 const css = compiledCss();
45 expect(css).toMatch(/100dvh - var\(--sticky-offset,\s*var\(--header-height\)\)/);
46 });
47 });
File History 2 commits
sha256:34035d72cef530c1ab9d6a6f53be18d803dde705fc3157617d70352a96d0747b Merge branch 'fix/wire-push-external-parent-manifest' into dev Human 8 days ago
sha256:fc04e4cae9e1774d6a21b65c45daeed0e6787eb581d13aa1b03bfe9384a34226 Merge branch 'fix/two-column-scroll-layout' into dev Human 8 days ago