feat(config): add shared browser cookie policy
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user