frontend: remove the stylix overlay and add hyperhive and Catppuccin light and dark themes
This commit is contained in:
parent
989d1d578c
commit
91e2d26133
1 changed files with 486 additions and 413 deletions
36
frontend/packages/swarm-ui/test/themes.test.mjs
Normal file
36
frontend/packages/swarm-ui/test/themes.test.mjs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
// The theme registry and how a stored choice reads. Run by `npm test`, which
|
||||
// imports the `.ts` module as it is.
|
||||
import assert from "node:assert/strict";
|
||||
import { test } from "node:test";
|
||||
import {
|
||||
AUTO_THEME,
|
||||
DEFAULT_THEME,
|
||||
THEMES,
|
||||
themeChoice,
|
||||
} from "../../shared/src/settings/themes.ts";
|
||||
|
||||
test("the default is one of the themes", () => {
|
||||
assert.ok(THEMES.some((t) => t.id === DEFAULT_THEME));
|
||||
});
|
||||
|
||||
test("every theme is light or dark, and the ids and labels are distinct", () => {
|
||||
for (const t of THEMES) assert.ok(["light", "dark"].includes(t.scheme));
|
||||
assert.equal(new Set(THEMES.map((t) => t.id)).size, THEMES.length);
|
||||
assert.equal(new Set(THEMES.map((t) => t.label)).size, THEMES.length);
|
||||
});
|
||||
|
||||
test("a theme id and auto read as themselves", () => {
|
||||
assert.equal(themeChoice("catppuccin-mocha-mauve"), "catppuccin-mocha-mauve");
|
||||
assert.equal(themeChoice(AUTO_THEME), AUTO_THEME);
|
||||
});
|
||||
|
||||
test("the values from before themes existed read as their successors", () => {
|
||||
assert.equal(themeChoice("system"), AUTO_THEME);
|
||||
assert.equal(themeChoice("light"), "hyperhive-light");
|
||||
assert.equal(themeChoice("dark"), "hyperhive-dark");
|
||||
});
|
||||
|
||||
test("an unknown value reads as the fallback", () => {
|
||||
assert.equal(themeChoice("blue"), DEFAULT_THEME);
|
||||
assert.equal(themeChoice(undefined, "hyperhive-light"), "hyperhive-light");
|
||||
});
|
||||
Loading…
Reference in a new issue