Something went wrong. Try again.
Monorepo for Tangled tangled.org
Something went wrong. Try again.
1234567891011121314151617181920212223import { describe, expect, it } from "vitest";import { themeAttribute, themeFromCookies } from "#lib/theme.ts";
describe("themeFromCookies", () => { it("reads the theme cookie among others", () => { expect(themeFromCookies("a=1; theme=dark; b=2")).toBe("dark"); expect(themeFromCookies("theme=light")).toBe("light"); });
it("falls back to auto for missing or unknown values", () => { expect(themeFromCookies(null)).toBe("auto"); expect(themeFromCookies("a=1")).toBe("auto"); expect(themeFromCookies("theme=sepia")).toBe("auto"); });});
describe("themeAttribute", () => { it("only stamps explicit themes", () => { expect(themeAttribute("dark")).toBe(' data-theme="dark"'); expect(themeAttribute("auto")).toBe(""); });});