返回 DeepSeek-Reasonix
katex-boxed-css.test.ts
根目录 / desktop / frontend / src / __tests__ / katex-boxed-css.test.ts
1 import { readFileSync } from "node:fs";
2
3 const styles = readFileSync(new URL("../styles.css", import.meta.url), "utf8");
4 const packageJSON = JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf8"));
5
6 const boxedRule = styles.match(/\.md\s+\.katex\s+\.fbox\s*\{([^}]*)\}/s)?.[1] ?? "";
7 if (!/width:\s*100%\s*;/.test(boxedRule)) {
8 throw new Error("KaTeX boxed frame must keep a standards-compatible width fallback");
9 }
10 if (!/width:\s*-webkit-fill-available\s*;/.test(boxedRule)) {
11 throw new Error("KaTeX boxed frame must fill the containing row in WebKit");
12 }
13 if (packageJSON.packageManager !== "pnpm@10.34.5") {
14 throw new Error(`frontend package manager pin drifted: ${packageJSON.packageManager ?? "missing"}`);
15 }
16
17 console.log("katex boxed CSS/package contract: PASS");
18
18 lines TYPESCRIPT