Files
t3code/apps/web/src/components/settings/themeEditorStore.test.ts
T
85b1734d4d feat(web): add modular theme library (#5226)
Co-authored-by: Claude Fable 5 <[email protected]>
Co-authored-by: Julius Marminge <[email protected]>
Co-authored-by: maria-rcks <[email protected]>
Co-authored-by: Julius Marminge <[email protected]>
2026-08-07 10:37:43 +02:00

41 lines
1.1 KiB
TypeScript

import { afterEach, describe, expect, it } from "vite-plus/test";
import { OCEAN_THEME_ID, T3_CHAT_THEME_ID } from "../../themePalette";
import { toggleThemeEditorForTheme, useThemeEditorStore } from "./themeEditorStore";
afterEach(() => {
useThemeEditorStore.getState().closeThemeEditor();
});
describe("toggleThemeEditorForTheme", () => {
it("opens a new editor seeded from the theme active for the current appearance", () => {
toggleThemeEditorForTheme({
theme: T3_CHAT_THEME_ID,
themeHalves: { dark: OCEAN_THEME_ID },
initialAppearance: "dark",
});
expect(useThemeEditorStore.getState().session).toMatchObject({
editingThemeId: null,
seedThemeId: OCEAN_THEME_ID,
seedName: null,
initialAppearance: "dark",
});
});
it("closes an open editor", () => {
toggleThemeEditorForTheme({
theme: T3_CHAT_THEME_ID,
themeHalves: null,
initialAppearance: "light",
});
toggleThemeEditorForTheme({
theme: T3_CHAT_THEME_ID,
themeHalves: null,
initialAppearance: "light",
});
expect(useThemeEditorStore.getState().session).toBeNull();
});
});