feat(config): add shared browser cookie policy
Quality / quality (ubuntu-latest) (push) Failing after 9m46s
Quality / quality (windows-latest) (push) Canceled after 0s

This commit is contained in:
2026-08-12 21:53:07 +05:30
parent a0dab308f0
commit 5de792f359
15 changed files with 198 additions and 22 deletions
+22
View File
@@ -47,6 +47,28 @@ describe("theme accents", () => {
expect(runtime).not.toContain("style.setProperty");
});
test("shared cookie config drives theme, accent, and the public browser helper", () => {
const theme = resolveThemeConfig(
{ palette: "rose" },
{
defaults: { domain: "example.com", path: "/", maxAge: 600, secure: true },
accent: { sameSite: "Strict" },
},
);
const runtime = renderThemeRuntime(theme);
expect(theme.themeCookie).toEqual({
domain: "example.com",
path: "/",
maxAge: 600,
secure: true,
});
expect(theme.accentCookie?.sameSite).toBe("Strict");
expect(runtime).toContain("window.wrnCookies={");
expect(runtime).toContain("writeCookie(THEME_COOKIE,name,THEME_COOKIE_OPTIONS)");
expect(runtime).toContain("configuredCookieOptions(preference,override)");
});
test("runtime scopes accent cookies to a configured parent domain", () => {
const theme = resolveThemeConfig({
palette: "rose",