Skip to content

Commit 301b6ac

Browse files
committed
fix(terminal): add isProfilesLoaded guard, harden sentinel, sync i18n (Zoo-Code-Org#119) (Zoo-Code-Org#321)
TerminalSettings.tsx: - Guard no-profiles hint render with isProfilesLoaded to prevent the hint from flashing before async profiles load. - Harden DEFAULT_PROFILE_VALUE sentinel from "__default__" to "__zoo_code_follow_vscode_sentinel__" to eliminate theoretical collision with a user-named VS Code profile. TerminalSettings.profile.spec.tsx: - Extend the empty-profiles test to assert the hint is absent before profiles load and present only after the empty list arrives. - Update sentinel references to match the new constant. i18n (ca/de/es/fr/hi/id/it/ja/ko/nl/pl/pt-BR/ru/tr/vi/zh-TW): - Replace outdated "override toggle" wording in label and description with unified single-dropdown profile selection language, aligning with the en/zh-CN baseline.
1 parent 956ba95 commit 301b6ac

18 files changed

Lines changed: 37 additions & 34 deletions

‎webview-ui/src/components/settings/TerminalSettings.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ type TerminalSettingsProps = HTMLAttributes<HTMLDivElement> & {
4545

4646
// Sentinel value that maps to `undefined` (use VS Code's default shell).
4747
// The Select component cannot accept empty-string item values.
48-
const DEFAULT_PROFILE_VALUE = "__default__"
48+
const DEFAULT_PROFILE_VALUE = "__zoo_code_follow_vscode_sentinel__"
4949

5050
export const TerminalSettings = ({
5151
terminalOutputPreviewSize,
@@ -242,7 +242,7 @@ export const TerminalSettings = ({
242242
</div>
243243
)}
244244

245-
{profileNames.length === 0 && (
245+
{isProfilesLoaded && profileNames.length === 0 && (
246246
<div
247247
className="text-vscode-descriptionForeground text-xs mt-1"
248248
data-testid="terminal-profile-no-profiles-hint">

‎webview-ui/src/components/settings/__tests__/TerminalSettings.profile.spec.tsx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ describe("TerminalSettings unified profile dropdown", () => {
9999
setup()
100100
const dropdown = screen.getByTestId("terminal-profile-dropdown")
101101
expect(dropdown).toBeInTheDocument()
102-
expect(dropdown.getAttribute("data-value")).toBe("__default__")
102+
expect(dropdown.getAttribute("data-value")).toBe("__zoo_code_follow_vscode_sentinel__")
103103
// Configure button visible because "Following VS Code profile" is selected
104104
expect(screen.getByTestId("terminal-profile-configure-button")).toBeInTheDocument()
105105
})
@@ -144,7 +144,7 @@ describe("TerminalSettings unified profile dropdown", () => {
144144
)
145145
})
146146

147-
fireEvent.click(screen.getByTestId("option-__default__"))
147+
fireEvent.click(screen.getByTestId("option-__zoo_code_follow_vscode_sentinel__"))
148148
expect(setCachedStateField).toHaveBeenCalledWith("terminalProfile", undefined)
149149
})
150150

@@ -190,13 +190,16 @@ describe("TerminalSettings unified profile dropdown", () => {
190190

191191
it("shows no-profiles hint when profile list is empty after load", () => {
192192
setup()
193+
// Hint should NOT appear before profiles are loaded
194+
expect(screen.queryByTestId("terminal-profile-no-profiles-hint")).not.toBeInTheDocument()
193195
act(() => {
194196
window.dispatchEvent(
195197
new MessageEvent("message", {
196198
data: { type: "terminalProfiles", profiles: [] },
197199
}),
198200
)
199201
})
202+
// Hint should appear after profiles loaded with empty list
200203
expect(screen.getByTestId("terminal-profile-no-profiles-hint")).toBeInTheDocument()
201204
})
202205

‎webview-ui/src/i18n/locales/ca/settings.json‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎webview-ui/src/i18n/locales/de/settings.json‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎webview-ui/src/i18n/locales/es/settings.json‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎webview-ui/src/i18n/locales/fr/settings.json‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎webview-ui/src/i18n/locales/hi/settings.json‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎webview-ui/src/i18n/locales/id/settings.json‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎webview-ui/src/i18n/locales/it/settings.json‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎webview-ui/src/i18n/locales/ja/settings.json‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)