fix(theme): persist switcher accent for SSR
This commit is contained in:
@@ -30,6 +30,8 @@ size: string = "default"
|
||||
|
||||
functions {
|
||||
client function choose(type, value) {
|
||||
if (type === "color") window.wrnAccent?.set(value)
|
||||
if (type === "theme") window.wrnTheme?.set(value)
|
||||
output[type]({ value: value })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@wrnexus/ui",
|
||||
"version": "0.8.14",
|
||||
"version": "0.8.15",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "src/index.ts",
|
||||
|
||||
@@ -374,10 +374,10 @@ test("navbar hover menu stays open while the pointer crosses into its panel", as
|
||||
});
|
||||
|
||||
test("preference switcher keeps only one popover open and closes outside", async () => {
|
||||
const html = await renderComponent(
|
||||
readFileSync(uiComponentPath("PreferenceSwitcher"), "utf8"),
|
||||
{},
|
||||
);
|
||||
const source = readFileSync(uiComponentPath("PreferenceSwitcher"), "utf8");
|
||||
const html = await renderComponent(source, {});
|
||||
expect(source).toContain("window.wrnAccent?.set(value)");
|
||||
expect(source).toContain("window.wrnTheme?.set(value)");
|
||||
const dom = mountHtml(html);
|
||||
const menus = Array.from(dom.querySelectorAll(".wrn-preferences__menu")) as HTMLDetailsElement[];
|
||||
const DomEvent = (dom.window as { Event: typeof Event }).Event;
|
||||
|
||||
Reference in New Issue
Block a user