authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-09-05 00:26:34-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-05 00:26:34-07:00
log393d1ffc9ee52696e4b5f226a956e9d4c65b2f6a
treeed985f915b3c353bb34c6086bbd17779ab96224c
parent3382b26c4f29bcbc709edf135c5486b7f1e0e211
signature Signed by PGP key B5690EEEBB952194

refactor(mobile): test terminal palettes through public theme API (#10002)


2 files changed, 8 insertions(+), 21 deletions(-)

apps/mobile/src/features/terminal/terminalTheme.test.ts+7-20
...@@ -3,15 +3,11 @@ import { BUILT_IN_THEMES, getThemeColorsForAppearance } from "@t3tools/shared/th...@@ -3,15 +3,11 @@ import { BUILT_IN_THEMES, getThemeColorsForAppearance } from "@t3tools/shared/th
33
4import { themeColorToNativeColor } from "../../lib/mobileTheme";4import { themeColorToNativeColor } from "../../lib/mobileTheme";
55
6import {6import { buildGhosttyThemeConfig, getMobileTerminalTheme } from "./terminalTheme";
7 buildGhosttyThemeConfig,
8 getMobileTerminalTheme,
9 getPierreTerminalTheme,
10} from "./terminalTheme";
117
12describe("getPierreTerminalTheme", () => {8describe("getMobileTerminalTheme", () => {
13 it("returns the Pierre light terminal palette", () => {9 it("preserves the default light terminal palette", () => {
14 expect(getPierreTerminalTheme("light")).toMatchObject({10 expect(getMobileTerminalTheme("t3-code", "light")).toMatchObject({
15 background: "#f2f2f7",11 background: "#f2f2f7",
16 foreground: "#6C6C71",12 foreground: "#6C6C71",
17 cursorForeground: "#009fff",13 cursorForeground: "#009fff",
...@@ -19,23 +15,14 @@ describe("getPierreTerminalTheme", () => {...@@ -19,23 +15,14 @@ describe("getPierreTerminalTheme", () => {
19 });15 });
20 });16 });
2117
22 it("returns the Pierre dark terminal palette", () => {18 it("preserves the default dark terminal palette", () => {
23 expect(getPierreTerminalTheme("dark")).toMatchObject({19 expect(getMobileTerminalTheme("t3-code", "dark")).toMatchObject({
24 background: "#0a0a0a",20 background: "#0a0a0a",
25 foreground: "#adadb1",21 foreground: "#adadb1",
26 cursorForeground: "#009fff",22 cursorForeground: "#009fff",
27 cursorBackground: "#0a0a0a",23 cursorBackground: "#0a0a0a",
28 });24 });
29 });25 });
30});
31
32describe("getMobileTerminalTheme", () => {
33 it("preserves the Pierre terminal for the default theme", () => {
34 for (const scheme of ["light", "dark"] as const) {
35 expect(getMobileTerminalTheme("t3-code", scheme)).toEqual(getPierreTerminalTheme(scheme));
36 }
37 });
38
39 it("applies the selected palette without replacing ANSI status colors", () => {26 it("applies the selected palette without replacing ANSI status colors", () => {
40 const standard = getMobileTerminalTheme("t3-code", "dark");27 const standard = getMobileTerminalTheme("t3-code", "dark");
41 const ocean = getMobileTerminalTheme("ocean", "dark");28 const ocean = getMobileTerminalTheme("ocean", "dark");
...@@ -58,7 +45,7 @@ describe("getMobileTerminalTheme", () => {...@@ -58,7 +45,7 @@ describe("getMobileTerminalTheme", () => {
5845
59describe("buildGhosttyThemeConfig", () => {46describe("buildGhosttyThemeConfig", () => {
60 it("serializes theme colors into a ghostty config file", () => {47 it("serializes theme colors into a ghostty config file", () => {
61 const config = buildGhosttyThemeConfig(getPierreTerminalTheme("dark"));48 const config = buildGhosttyThemeConfig(getMobileTerminalTheme("t3-code", "dark"));
6249
63 expect(config).toContain("background = #0a0a0a");50 expect(config).toContain("background = #0a0a0a");
64 expect(config).toContain("foreground = #adadb1");51 expect(config).toContain("foreground = #adadb1");
apps/mobile/src/features/terminal/terminalTheme.ts+1-1
...@@ -74,7 +74,7 @@ const PIERRE_DARK_THEME: TerminalTheme = {...@@ -74,7 +74,7 @@ const PIERRE_DARK_THEME: TerminalTheme = {
74 ],74 ],
75};75};
7676
77export function getPierreTerminalTheme(scheme: TerminalAppearanceScheme): TerminalTheme {77function getPierreTerminalTheme(scheme: TerminalAppearanceScheme): TerminalTheme {
78 return scheme === "light" ? PIERRE_LIGHT_THEME : PIERRE_DARK_THEME;78 return scheme === "light" ? PIERRE_LIGHT_THEME : PIERRE_DARK_THEME;
79}79}
8080