import assert from "node:assert/strict"; import { readFileSync } from "node:fs"; import test from "node:test"; const starterHome = readFileSync(new URL("../src/components/starter-home.tsx", import.meta.url), "utf8"); const css = readFileSync(new URL("../src/app/globals.css", import.meta.url), "utf8"); const design = readFileSync(new URL("../DESIGN.md", import.meta.url), "utf8"); function starterEntryBlock(): string { const start = css.indexOf(".starter-entry {"); const end = css.indexOf(".starter-entry > svg"); assert.ok(start >= 0 && end > start); return css.slice(start, end); } test("starter entries stay native buttons with a 36px pill and a 44px hit area", () => { assert.match(starterHome, / { const hover = css.slice(css.indexOf(".starter-entry:not(:disabled):hover"), css.indexOf(".starter-entry:focus-visible")); assert.match(hover, /color-mix\(in srgb, var\(--color-border-strong\) 45%, var\(--color-border\)\)/); assert.doesNotMatch(hover, /border-color:\s*var\(--color-action\)/); assert.match(css, /\.starter-entry:focus-visible\s*\{[^}]*outline:\s*3px solid color-mix\(in srgb, var\(--color-focus\) 80%, transparent\)/); assert.match(css, /\.starter-entry\[data-opening="true"\]\s*\{\s*cursor:\s*progress/); assert.match(css, /@media \(max-width:\s*375px\)\s*\{[^}]*\.starter-entry-row\s*\{\s*max-width:\s*100%/); assert.match(css, /@media \(prefers-reduced-motion:\s*reduce\)[\s\S]*transition-duration:\s*\.01ms !important/); assert.match(design, /--starter-entry-border/); assert.match(design, /inset: -4px/); });