feat(t5): Darstellung hell/dunkel/Sonne ohne Flackern (T5a A2)
Blockierendes Skript im <head> setzt Darstellung, Kontrast und Bewegung vor dem ersten Zeichnen (gleiche Logik wie resolveAppearance, für alle Eingaben getestet), theme-color je Satz, Wahl je Gerät in localStorage mit Rückfall bei gesperrtem Speicher; Abgleich über Tabs, Systemeinstellungen und Seitenwechsel an einer Stelle. Profil-Karte „Darstellung“, Sonnenmodus im Benutzermenü; Dunkel bleibt bis A4 hinter NEXT_PUBLIC_APPEARANCE_DARK. next-themes entfernt. ARCHITECTURE §9: 'unsafe-inline' der Frontend-CSP als getragenes Risiko mit Begründung. Refs #26 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
1 parent
947a46f435
commit
cf53cf35ac
22 files changed
+980
-97
No files matched your search
@@ -0,0 +1,27 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { render } from "@testing-library/react";
|
||||
import { resetDocument } from "@/lib/appearance/test-helpers";
|
||||
import { AppearanceSync } from "./appearance-sync";
|
||||
|
||||
let pathname = "/a";
|
||||
vi.mock("next/navigation", () => ({ usePathname: () => pathname }));
|
||||
|
||||
beforeEach(resetDocument);
|
||||
afterEach(resetDocument);
|
||||
|
||||
describe("AppearanceSync", () => {
|
||||
it("puts the chosen theme-color back after a route change", () => {
|
||||
const meta = document.createElement("meta");
|
||||
meta.name = "theme-color";
|
||||
document.head.append(meta);
|
||||
window.localStorage.setItem("apicore.contrast", "sun");
|
||||
const { rerender } = render(<AppearanceSync />);
|
||||
expect(meta.content).toBe("#ffffff");
|
||||
|
||||
meta.content = "#f9f4ea"; // Next's metadata update
|
||||
pathname = "/b";
|
||||
rerender(<AppearanceSync />);
|
||||
|
||||
expect(meta.content).toBe("#ffffff");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user