diff --git a/REUSE.toml b/REUSE.toml index d6ee6f1c..9be0208a 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -52,8 +52,7 @@ path = [ "src/assets/vortex_wordmark_dark_theme.svg", "public/bench/Vortex_Black_NoBG.svg", "public/bench/Vortex_White_NoBG.svg", - "public/bench/icon-dark.png", - "public/bench/icon-light.png", + "public/bench/favicon.ico", ] SPDX-FileCopyrightText = "Copyright the Vortex contributors" SPDX-License-Identifier = "CC-BY-4.0" diff --git a/public/bench/favicon.ico b/public/bench/favicon.ico new file mode 100644 index 00000000..744a7734 Binary files /dev/null and b/public/bench/favicon.ico differ diff --git a/public/bench/icon-dark.png b/public/bench/icon-dark.png deleted file mode 100644 index 43199fc4..00000000 Binary files a/public/bench/icon-dark.png and /dev/null differ diff --git a/public/bench/icon-light.png b/public/bench/icon-light.png deleted file mode 100644 index 81f1c8fd..00000000 Binary files a/public/bench/icon-light.png and /dev/null differ diff --git a/src/app/(bench)/bench/[...notFound]/page.tsx b/src/app/(bench)/bench/[...notFound]/page.tsx index b9bb9e75..b5bbd934 100644 --- a/src/app/(bench)/bench/[...notFound]/page.tsx +++ b/src/app/(bench)/bench/[...notFound]/page.tsx @@ -6,9 +6,8 @@ import { notFound } from 'next/navigation'; /** * Every bench URL no other bench route matches. The app has two root layouts, * and an unmatched URL gets the marketing site's 404 (src/app/global-not-found.tsx). - * This route keeps bench's unmatched paths out of the site's 404. bench has no - * not-found.tsx, so Next.js answers with its default 404 document: it carries - * bench's metadata, but not bench's layout, header, or `lang`. + * This route keeps bench's unmatched paths out of the site's 404: they get + * bench's not-found.tsx, the same 404 body in bench's layout. */ export default function UnmatchedBenchPath(): never { notFound(); diff --git a/src/app/(bench)/bench/layout.test.ts b/src/app/(bench)/bench/layout.test.ts index 83c3d723..44cf3924 100644 --- a/src/app/(bench)/bench/layout.test.ts +++ b/src/app/(bench)/bench/layout.test.ts @@ -18,8 +18,7 @@ vi.mock('@/styles/vortex.css', () => ({})); // The site's footer, as a stand-in that shows the props bench gives it. Each page renders the // header (BenchHeader), because the filter dropdown takes the page's data. vi.mock('@/components/layout/footer', () => ({ - Footer: ({ origin, solid }: { origin: string; solid: boolean }) => - createElement('footer', { 'data-origin': origin, 'data-solid': String(solid) }), + Footer: ({ origin }: { origin: string }) => createElement('footer', { 'data-origin': origin }), })); // next/font is a build step; its classes set the design system's --vx-face-* variables. vi.mock('@/lib/fonts', () => ({ FONT_CLASSES: 'face-sans face-mono' })); @@ -31,13 +30,18 @@ vi.mock('next/headers', () => ({ headers: async () => requestHeaders })); const html = renderToStaticMarkup(await RootLayout({ children: createElement('main') })); /** Load the layout's markup in a browser-like document, scripts on or off. */ -function load(runScripts: boolean, theme?: string): Document { +function load(runScripts: boolean, theme?: string, cookie?: string, prefersDark = true): Document { return new JSDOM(`${html}`, { url: 'https://bench.vortex.dev/', ...(runScripts ? { runScripts: 'dangerously' as const } : {}), beforeParse(window) { + // jsdom has no matchMedia: an OS set to Dark, unless the test says Light. + Object.assign(window, { matchMedia: () => ({ matches: prefersDark }) }); if (theme !== undefined) { - window.localStorage.setItem('bench-theme', theme); + window.localStorage.setItem('vx-theme', theme); + } + if (cookie !== undefined) { + window.document.cookie = cookie; } }, }).window.document; @@ -45,16 +49,21 @@ function load(runScripts: boolean, theme?: string): Document { describe('RootLayout', () => { it('renders the root as no-js, which only a script swaps for js', () => { - expect(html).toMatch(/^ { @@ -62,9 +71,13 @@ describe('RootLayout', () => { expect(html).not.toMatch(/googleapis|gstatic/); }); - it('follows the OS until a reader chooses a theme', () => { - expect(load(true).documentElement.dataset.theme).toBe('system'); - expect(load(false).documentElement.dataset.theme).toBe('system'); + // Will, 4 Nov 2026: "shared cookie should be respected! but if no other info, dark" (design + // system DECISIONS 43). + it('is Dark until a reader chooses a theme, even when the OS prefers Light', () => { + const page = load(true, undefined, undefined, false); + expect(page.documentElement.dataset.theme).toBe('dark'); + expect(page.documentElement.dataset.themeChoice).toBe('dark'); + expect(load(false).documentElement.dataset.theme).toBe('dark'); }); }); @@ -80,9 +93,9 @@ describe("the layout's skip link", () => { }); describe("the layout's frame", () => { - it("puts every page above the site's footer, pointed at the site, with a solid rule", () => { + it("puts every page above the site's one footer, pointed at the site", () => { expect(html).toMatch( - /
<\/main>