test: a watch's weight by age, and each contrast test under its reason

`draw.recency` weighs every watch of both affinities: an undated watch
and a future one now have a test (deleting either branch fails it). The
over-the-picture contrast test moves below the form-on-chrome test, so
each sits under the comment that explains it.
This commit is contained in:
2026-11-08 00:49:22 +01:00
parent 470caacfb0
commit 350913b6c2
2 changed files with 25 additions and 11 deletions
+11 -11
View File
@@ -59,17 +59,6 @@ describe("the media colours", () => {
// accent for what must be seen: a light theme's are dark (#b91c1c 2.8:1, Slate's accent 2.8:1 on
// the chrome). Its error edge and text take the media red, and every focus ring in it — the base
// ring and a field's focus edge both read --focus — the media amber. [WCAG 1.4.11, 1.4.3]
// Text over the picture sits on a black panel the frame shows through: its worst ground is a white
// frame. The error line on it is the media red (a light theme's danger was 1.6:1 there). [WCAG 1.4.3]
it("an error over the picture holds 4.5:1 on its panel over a white frame", () => {
const player = readFileSync(new URL("../modules/plex/PlexPlayer.tsx", import.meta.url), "utf8");
const over = /const OVER_VIDEO =\s*"([^"]+)"/.exec(player)?.[1] ?? "";
expect(over.split(" ")).toContain("media-scope"); // --danger is the media red under it
const alpha = Number(/\bbg-black\/(\d+)\b/.exec(over)?.[1]) / 100;
const ground = mixHex("#000000", "#ffffff", alpha);
expect(hexContrast(media()["media-danger"]!, ground)).toBeGreaterThanOrEqual(4.5);
expect(hexContrast("#ffffff", ground)).toBeGreaterThanOrEqual(4.5);
});
it("a form on the player chrome says an error and a focus in colours that hold there", () => {
expect(hexContrast(media()["media-danger"]!, media()["media-chrome"]!)).toBeGreaterThanOrEqual(
4.5,
@@ -91,6 +80,17 @@ describe("the media colours", () => {
expect(field).toMatch(/\bfocus-within:ring-focus\b/);
expect(field).not.toMatch(/\bfocus-within:(border|ring)-accent\b/);
});
// Text over the picture sits on a black panel the frame shows through: its worst ground is a white
// frame. The error line on it is the media red (a light theme's danger was 1.6:1 there). [WCAG 1.4.3]
it("an error over the picture holds 4.5:1 on its panel over a white frame", () => {
const player = readFileSync(new URL("../modules/plex/PlexPlayer.tsx", import.meta.url), "utf8");
const over = /const OVER_VIDEO =\s*"([^"]+)"/.exec(player)?.[1] ?? "";
expect(over.split(" ")).toContain("media-scope"); // --danger is the media red under it
const alpha = Number(/\bbg-black\/(\d+)\b/.exec(over)?.[1]) / 100;
const ground = mixHex("#000000", "#ffffff", alpha);
expect(hexContrast(media()["media-danger"]!, ground)).toBeGreaterThanOrEqual(4.5);
expect(hexContrast("#ffffff", ground)).toBeGreaterThanOrEqual(4.5);
});
it("every surface painted the player chrome names its marks: the focus ring and what is chosen", () => {
const block = (name: string) => {