Files
speaking-practice/tests/typography-style.test.mjs
T
TTlaji 67dcea21d0
Deploy Speaking Practice / deploy (push) Successful in 2m13s
style: polish responsive typography and transcript states
2026-06-09 22:56:57 +08:00

32 lines
1.0 KiB
JavaScript

import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
const __dirname = dirname(fileURLToPath(import.meta.url));
const css = readFileSync(join(__dirname, "..", "styles.css"), "utf8");
assert.match(
css,
/--font-sans:\s*Inter,\s*"Noto Sans SC",\s*"Microsoft YaHei UI",\s*"PingFang SC"/,
"global font stack should pair polished Latin and Chinese UI fonts",
);
assert.match(
css,
/body\s*\{[\s\S]*font-family:\s*var\(--font-sans\);[\s\S]*line-height:\s*1\.5;[\s\S]*text-rendering:\s*optimizeLegibility;[\s\S]*-webkit-font-smoothing:\s*antialiased;/,
"body should use the shared font stack with improved rendering",
);
assert.match(
css,
/\.brand h1\s*\{[\s\S]*font-weight:\s*760;[\s\S]*letter-spacing:\s*0;/,
"brand title should use a refined strong weight",
);
assert.match(
css,
/\.home-card-body h3\s*\{[\s\S]*font-weight:\s*760;[\s\S]*line-height:\s*1\.35;/,
"home card titles should be less heavy and easier to scan",
);