complete performance and reliability follow-ups
This commit is contained in:
@@ -5,6 +5,8 @@ import {
|
||||
resolveThemeConfig,
|
||||
resolveThemeName,
|
||||
renderThemeCss,
|
||||
renderActiveThemeCss,
|
||||
activeThemeCssHref,
|
||||
renderThemeRuntime,
|
||||
} from "../src/index.ts";
|
||||
|
||||
@@ -85,6 +87,17 @@ test("renderThemeCss emits :root + per-theme blocks and --wire-* vars", () => {
|
||||
expect(css).toContain("font-family:var(--wire-font-sans");
|
||||
});
|
||||
|
||||
test("active theme CSS contains only the selected theme and accent", () => {
|
||||
const theme = resolveThemeConfig({ default: "dark", palette: "rose" });
|
||||
const full = renderThemeCss(theme);
|
||||
const active = renderActiveThemeCss(theme, "dark", "rose");
|
||||
expect(active).toContain(":root{");
|
||||
expect(active).not.toContain('[data-theme="light"]');
|
||||
expect(active.length).toBeLessThan(full.length / 4);
|
||||
expect(activeThemeCssHref("dark", "rose")).toBe("/__wrnexus/theme/dark/rose.css");
|
||||
expect(() => renderActiveThemeCss(theme, "missing")).toThrow("Unknown theme");
|
||||
});
|
||||
|
||||
test("renderThemeRuntime bakes the theme names for cycling", () => {
|
||||
const t = resolveThemeConfig();
|
||||
const js = renderThemeRuntime(t);
|
||||
|
||||
Reference in New Issue
Block a user