mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
Roving focus, Home/End, wrap, toggle mode, disabled and the chosen segment's fill are now asserted through key presses and computed styles instead of markup greps. The static render test is deleted; its two source sweeps move to segmented-single-implementation.test.ts. The browser setup sets the default theme class so colour tokens resolve, and pre-bundles the browser files' dependencies so a cold cache does not reload the page mid-run.
38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
/**
|
|
* Setup for the `browser` project (`*.browser.test.tsx`, headless Chromium).
|
|
*
|
|
* - The app stylesheet, compiled by Vite through the project's PostCSS
|
|
* config, so components lay out and hide as they do in the app, under the
|
|
* theme class the boot script sets for a first visit (`dark`, see
|
|
* `src/lib/pwa/theme-color.ts`); without one no colour token resolves.
|
|
* - The EN catalog, the fallback floor of every `t()` chain, loaded through
|
|
* the production loader. `renderWithApp` loads any other locale it is
|
|
* asked for.
|
|
* - After every test: the real `fetch` and the page's starting address come
|
|
* back, so a stub or a URL write never reaches the next test. Rendered
|
|
* trees are unmounted by `vitest-browser-react` itself.
|
|
*/
|
|
import "@/app/globals.css";
|
|
|
|
import { afterEach, beforeAll, beforeEach } from "vitest";
|
|
|
|
import { loadMessages } from "@/lib/i18n/load-locale";
|
|
|
|
import { restoreFetch } from "./fetch-stub";
|
|
import { rememberAddress, restoreAddress } from "./url";
|
|
|
|
document.documentElement.classList.add("dark");
|
|
|
|
beforeAll(async () => {
|
|
await loadMessages("en");
|
|
});
|
|
|
|
beforeEach(() => {
|
|
rememberAddress();
|
|
});
|
|
|
|
afterEach(() => {
|
|
restoreFetch();
|
|
restoreAddress();
|
|
});
|