- F16: --rating (theme-scoped gold, 4.5:1 on the page and its chip), --rating-media, --live/--live-fg, --media-chrome replace 14 palette literals; a lint rule refuses palette classes; the theme contract measures them. - The Plex player's notices drew over its open settings/tracks popovers: notices z-base, popovers z-menu. - The player's info overlay rendered theme tokens on its always-dark panel: on a light theme the score (2.6:1), collection years (3.2:1) and cast initials (1.05:1) were unreadable; onDark variants now. - The lint-rule contract tests share one ESLint with a one-off warm-up (a cold first lint took 8 s, past vitest's 5 s).
33 lines
1.4 KiB
TypeScript
33 lines
1.4 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import { eslint } from "./lintProbe.testkit";
|
|
|
|
// `local/sortable-a11y` (eslint.config.js): every sortable list speaks the user's language to a
|
|
// screen reader, through ui/sortableA11y. Three of four lists had shipped dnd-kit's English
|
|
// defaults. A rule that matches nothing looks exactly like a clean codebase, so this asserts it fires.
|
|
const RULE = "local/sortable-a11y";
|
|
|
|
async function hits(source: string, filePath = "src/components/__probe.tsx"): Promise<number> {
|
|
const [result] = await eslint.lintText(source, { filePath });
|
|
return (result?.messages ?? []).filter((m) => m.ruleId === RULE).length;
|
|
}
|
|
|
|
describe("a sortable list", () => {
|
|
it("is refused without translated screen-reader text", async () => {
|
|
expect(await hits(`export const A = () => <DndContext onDragEnd={() => {}} />;\n`)).toBe(1);
|
|
expect(
|
|
await hits(`import { useSortable } from "@dnd-kit/sortable";\nexport { useSortable };\n`),
|
|
).toBe(1);
|
|
});
|
|
|
|
it("is fine through ui/sortableA11y, which alone may wrap dnd-kit's hook", async () => {
|
|
expect(await hits(`export const B = ({ a }) => <DndContext accessibility={a} />;\n`)).toBe(0);
|
|
expect(
|
|
await hits(
|
|
`import { useSortable } from "@dnd-kit/sortable";\nexport { useSortable };\n`,
|
|
"src/components/ui/sortableA11y.ts",
|
|
),
|
|
).toBe(0);
|
|
});
|
|
});
|