feat(styles): share accent cookies across app domains
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user