| 1 | import { describe, expect, it } from "vite-plus/test"; |
| 2 | import { MOBILE_THEME_IDS } from "@t3tools/shared/themePalettes"; |
| 3 | |
| 4 | import { getMobileThemeVariables } from "./mobileTheme"; |
| 5 | import { createNativeComposerTheme } from "./nativeComposerTheme"; |
| 6 | |
| 7 | describe("native composer colors", () => { |
| 8 | it.each(MOBILE_THEME_IDS)("delivers parsable colors for %s in both appearances", (themeId) => { |
| 9 | for (const appearance of ["light", "dark"] as const) { |
| 10 | const variables = getMobileThemeVariables(themeId, appearance); |
| 11 | const theme = createNativeComposerTheme(variables); |
| 12 | for (const color of Object.values(theme)) expect(color).toMatch(/^#[\da-f]{6}$/i); |
| 13 | expect(theme.text).toBe(variables["--color-foreground"]); |
| 14 | expect(theme.skillBorder).not.toBe(theme.skillBackground); |
| 15 | } |
| 16 | }); |
| 17 | |
| 18 | it("flattens Material You alpha colors over the composer rather than falling back to defaults", () => { |
| 19 | const theme = createNativeComposerTheme({ |
| 20 | ...getMobileThemeVariables("t3-code", "light"), |
| 21 | "--color-screen": "#ffffffff", |
| 22 | "--color-composer-surface": "#ffffffff", |
| 23 | "--color-subtle": "#0000000d", |
| 24 | "--color-placeholder": "#0000009e", |
| 25 | "--color-inline-skill-background": "#ffffffff", |
| 26 | "--color-inline-skill-border": "#00000080", |
| 27 | }); |
| 28 | expect(theme.chipBackground).toBe("#f2f2f2"); |
| 29 | expect(theme.placeholder).toBe("#616161"); |
| 30 | expect(theme.skillBorder).toBe("#7f7f7f"); |
| 31 | }); |
| 32 | }); |