1import { afterEach, describe, expect, it } from "vite-plus/test";
2
3import { OCEAN_THEME_ID, T3_CHAT_THEME_ID } from "../../themePalette";
4import { toggleThemeEditorForTheme, useThemeEditorStore } from "./themeEditorStore";
5
6afterEach(() => {
7 useThemeEditorStore.getState().closeThemeEditor();
8});
9
10describe("toggleThemeEditorForTheme", () => {
11 it("opens a new editor seeded from the theme active for the current appearance", () => {
12 toggleThemeEditorForTheme({
13 theme: T3_CHAT_THEME_ID,
14 themeHalves: { dark: OCEAN_THEME_ID },
15 initialAppearance: "dark",
16 });
17
18 expect(useThemeEditorStore.getState().session).toMatchObject({
19 editingThemeId: null,
20 seedThemeId: OCEAN_THEME_ID,
21 seedName: null,
22 initialAppearance: "dark",
23 });
24 });
25
26 it("closes an open editor", () => {
27 toggleThemeEditorForTheme({
28 theme: T3_CHAT_THEME_ID,
29 themeHalves: null,
30 initialAppearance: "light",
31 });
32 toggleThemeEditorForTheme({
33 theme: T3_CHAT_THEME_ID,
34 themeHalves: null,
35 initialAppearance: "light",
36 });
37
38 expect(useThemeEditorStore.getState().session).toBeNull();
39 });
40});