chore(repo): reinitialize repository

This commit is contained in:
2026-03-18 11:29:54 +08:00
commit 24871e213a
288 changed files with 44369 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
import { afterEach, describe, expect, it } from "vitest";
import { applyThemeToDocument, getStoredTheme, resolveTheme } from "./theme";
afterEach(() => {
document.documentElement.removeAttribute("data-theme");
document.documentElement.removeAttribute("style");
window.localStorage.clear();
});
describe("theme", () => {
it("resolves configured themes as static theme definitions", () => {
const resolved = resolveTheme("mist-blue");
expect(resolved.appearance).toBe("light");
expect(resolved.definition.id).toBe("mist-blue");
expect(resolved.definition.swatches[0]).toBe("#edf3f7");
});
it("applies the active theme on the document root", () => {
applyThemeToDocument("mist-blue");
expect(document.documentElement.dataset.theme).toBe("mist-blue");
expect(document.documentElement.style.colorScheme).toBe("light");
});
it("falls back to the default theme when local storage contains an unknown value", () => {
window.localStorage.setItem("inbox-dashboard-theme", "unknown-theme");
expect(getStoredTheme()).toBe("atelier-copper");
});
});