| 1 | import { describe, expect, it } from "vite-plus/test"; |
| 2 | |
| 3 | import { mobileHtmlRenderTheme } from "./htmlRenderTheme"; |
| 4 | import { getMobileThemeVariables } from "./mobileTheme"; |
| 5 | |
| 6 | describe("mobileHtmlRenderTheme", () => { |
| 7 | it("paints the page with the feed's own canvas", () => { |
| 8 | const variables = { |
| 9 | ...getMobileThemeVariables("grove", "dark"), |
| 10 | "--color-thread-canvas": "#101010", |
| 11 | }; |
| 12 | const theme = (platform: string) => |
| 13 | mobileHtmlRenderTheme({ |
| 14 | themeId: "grove", |
| 15 | appearance: "dark", |
| 16 | variables, |
| 17 | systemColors: false, |
| 18 | platform, |
| 19 | }); |
| 20 | expect(theme("android").variables["--background"]).toBe("#101010"); |
| 21 | expect(theme("ios").variables["--background"]).toBe(variables["--color-screen"]); |
| 22 | }); |
| 23 | |
| 24 | it("takes Material You's system roles over the default palette", () => { |
| 25 | const variables = { |
| 26 | ...getMobileThemeVariables("t3-code", "light"), |
| 27 | "--color-primary": "#6750A4FF", |
| 28 | "--color-foreground": "#1D1B20FF", |
| 29 | }; |
| 30 | const theme = mobileHtmlRenderTheme({ |
| 31 | themeId: "material-you", |
| 32 | appearance: "light", |
| 33 | variables, |
| 34 | systemColors: true, |
| 35 | platform: "android", |
| 36 | }); |
| 37 | expect(theme.variables["--accent"]).toBe("#6750A4FF"); |
| 38 | expect(theme.variables["--foreground"]).toBe("#1D1B20FF"); |
| 39 | }); |
| 40 | }); |