mirror of
https://github.com/PR0M3TH3AN/bitgate.git
synced 2026-10-27 08:31:00 +00:00
Widget styles now prefer --bitgate-* custom properties, falling back to the deprecated --gov-* names and then the existing defaults so current pages and overrides keep working. Browser bundles and ESM entry points expose VERSION (and window.bitgate.version) from package.json. Document allowlist on the widget policy preset list. Sync the lockfile so npm ci sees @bitgate/standalone. Co-authored-by: thePR0M3TH3AN <[email protected]>
32 lines
1.2 KiB
JavaScript
32 lines
1.2 KiB
JavaScript
import { describe, expect, it } from "vitest";
|
|
|
|
import { BASE_STYLES, THEME_DEFAULTS, themeVar } from "../src/base.js";
|
|
|
|
describe("theme tokens", () => {
|
|
it("resolves --bitgate-* first, then deprecated --gov-*, then the default", () => {
|
|
for (const name of Object.keys(THEME_DEFAULTS)) {
|
|
expect(themeVar(/** @type {keyof typeof THEME_DEFAULTS} */ (name))).toBe(
|
|
`var(--bitgate-${name}, var(--gov-${name}, ${THEME_DEFAULTS[name]}))`,
|
|
);
|
|
}
|
|
});
|
|
|
|
it("keeps --gov-* host defaults so existing overrides still apply", () => {
|
|
for (const [name, value] of Object.entries(THEME_DEFAULTS)) {
|
|
expect(BASE_STYLES).toContain(`--gov-${name}: ${value}`);
|
|
}
|
|
});
|
|
|
|
it("does not assign --bitgate-* on :host (that would shadow --gov-* overrides)", () => {
|
|
expect(BASE_STYLES).not.toMatch(/--bitgate-[a-z]+:/);
|
|
});
|
|
|
|
it("uses the fallback chain at every painted token", () => {
|
|
expect(BASE_STYLES).toContain(themeVar("fg"));
|
|
expect(BASE_STYLES).toContain(themeVar("muted"));
|
|
expect(BASE_STYLES).toContain(themeVar("border"));
|
|
expect(BASE_STYLES).toContain(themeVar("surface"));
|
|
expect(BASE_STYLES).toContain(themeVar("radius"));
|
|
});
|
|
});
|