feat(styles): share accent cookies across app domains
Quality / quality (ubuntu-latest) (push) Failing after 9m48s
Quality / quality (windows-latest) (push) Canceled after 0s

This commit is contained in:
2026-08-12 20:40:35 +05:30
parent 32187a425c
commit 6133d33b8c
5 changed files with 50 additions and 11 deletions
+13
View File
@@ -46,6 +46,19 @@ describe("theme accents", () => {
expect(runtime).not.toContain("localStorage");
expect(runtime).not.toContain("style.setProperty");
});
test("runtime scopes accent cookies to a configured parent domain", () => {
const theme = resolveThemeConfig({
palette: "rose",
accent: { cookie: { domain: "localhost", path: "/", sameSite: "Lax", secure: false } },
});
const runtime = renderThemeRuntime(theme);
expect(theme.accentCookie?.domain).toBe("localhost");
expect(runtime).toContain('"domain":"localhost"');
expect(runtime).toContain("deleteCookie(ACCENT_COOKIE);");
expect(runtime).toContain("writeCookie(ACCENT_COOKIE,name,ACCENT_COOKIE_OPTIONS)");
});
});
test("live document accent has priority over cookie and default", () => {
const runtime = renderThemeRuntime(