de103b113f
Route the terminal settings page's copy through i18next: the shell card, the font/font-size/link cards, and the section headings. Shell paths, font family names, and every select value stay untranslated — they are data compared with `===`. The font-category label and badge tables are module scope, so they hold catalog keys resolved at render rather than copy. Adds the three paths to `i18nGuardFiles` and the screen to the pseudo-coverage `SCREENS` list. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
53 lines
1.7 KiB
TypeScript
53 lines
1.7 KiB
TypeScript
import { cleanup, render, screen } from "@testing-library/react";
|
|
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
import { ShellSettingsCard } from "./shell-settings-card";
|
|
|
|
const shellOptions = [
|
|
{ value: "/bin/bash", label: "bash" },
|
|
{ value: "/bin/zsh", label: "zsh" },
|
|
];
|
|
|
|
afterEach(cleanup);
|
|
|
|
describe("ShellSettingsCard", () => {
|
|
it("renders its copy through the catalog", () => {
|
|
render(
|
|
<ShellSettingsCard
|
|
preferredShell=""
|
|
onPreferredShellChange={vi.fn()}
|
|
shellLoaded
|
|
shellOptions={shellOptions}
|
|
/>,
|
|
);
|
|
|
|
expect(screen.getByText("Shell")).toBeTruthy();
|
|
expect(screen.getByText("Pick the default shell for task sessions")).toBeTruthy();
|
|
expect(screen.getByText("Preferred Shell")).toBeTruthy();
|
|
expect(
|
|
screen.getByText(
|
|
"New task sessions will use this shell. Existing sessions keep their current shell.",
|
|
),
|
|
).toBeTruthy();
|
|
});
|
|
|
|
it("keeps the example shell path untranslated in the custom input", () => {
|
|
// A shell not in `shellOptions` resolves to the custom branch, which is the
|
|
// only place the placeholder renders. The placeholder is an example path —
|
|
// data, not copy — so it must stay verbatim in every locale.
|
|
render(
|
|
<ShellSettingsCard
|
|
preferredShell="/opt/homebrew/bin/fish"
|
|
onPreferredShellChange={vi.fn()}
|
|
shellLoaded
|
|
shellOptions={shellOptions}
|
|
/>,
|
|
);
|
|
|
|
const customInput = screen.getByPlaceholderText("/bin/zsh");
|
|
expect((customInput as HTMLInputElement).value).toBe("/opt/homebrew/bin/fish");
|
|
expect(
|
|
screen.getByText("Enter a shell path or command available in the agent environment."),
|
|
).toBeTruthy();
|
|
});
|
|
});
|