import { describe, expect, it } from "bun:test"; import { typeScaleProblems } from "./check-type-scale"; describe("fluid type scale lint", () => { it("accepts named roles and inherited inline code", () => { let css = ` .prose { font-size: var(--text-base); } .control { font: 500 var(--text-sm) / var(--text-sm--line-height) Inter; } .code { font-size: inherit; } .editor { font-size: var(--plan-body); } `; let markup = `
Label
'], ["sample.ts", 'let css = ".label { font-size: 14.5px; }";'], ["sample.css", ":root { --text-tiny: 14.5px; }"], ] as const; for (let [file, source] of cases) { expect(typeScaleProblems(file, source)).toHaveLength(1); } }); it("permits the audited scale specimen but rejects the same dynamic style elsewhere", () => { let source = "style={{ fontSize: `var(${size})` }}"; expect(typeScaleProblems("apps/web/src/design-audit/foundations.tsx", source)).toEqual([]); expect(typeScaleProblems("apps/web/src/other.tsx", source)).toHaveLength(1); }); it("does not flag examples in comments", () => { expect(typeScaleProblems("sample.tsx", "// fontSize: 14.5\n/* font-size: 14.5px; */")) .toEqual([]); }); });