diff --git a/src/components/providers/forms/CodexOAuthSection.tsx b/src/components/providers/forms/CodexOAuthSection.tsx index 29662d7f0..17715b24f 100644 --- a/src/components/providers/forms/CodexOAuthSection.tsx +++ b/src/components/providers/forms/CodexOAuthSection.tsx @@ -247,22 +247,23 @@ export const CodexOAuthSection: React.FC = ({ )} - {!allowUnboundSelection && !selectedAccountId && ( - - - {accountChoicePlaceholder} - - - )} + {!requireExplicitSelection && + !allowUnboundSelection && + !selectedAccountId && ( + + + {accountChoicePlaceholder} + + + )} {!nativeLoginOnly && accounts.map((account, index) => (
- = ({ ))} {!nativeLoginOnly && onManageAccounts && ( - +
- + {t( "codexOauth.addOrManageAccounts", @@ -306,10 +310,9 @@ export const CodexOAuthSection: React.FC = ({ {allowUnboundSelection && (
- {noneOptionLabel ?? t("codexOauth.useDefaultAccount", "使用默认账号")} diff --git a/tests/components/CodexOAuthSection.test.tsx b/tests/components/CodexOAuthSection.test.tsx index 319d28fb1..e15939871 100644 --- a/tests/components/CodexOAuthSection.test.tsx +++ b/tests/components/CodexOAuthSection.test.tsx @@ -228,13 +228,15 @@ describe("CodexOAuthSection", () => { ).toBeInTheDocument(); }); - it("shows a disabled account prompt before a managed account is selected", () => { + it("shows one disabled prompt before a managed account is selected", async () => { + const user = userEvent.setup(); render( , ); @@ -244,6 +246,11 @@ describe("CodexOAuthSection", () => { "font-normal", "text-muted-foreground", ); + + await user.click(screen.getByRole("combobox")); + expect( + screen.getAllByRole("option", { name: "请选择登录方式" }), + ).toHaveLength(1); }); it("does not default a new Official card to the current Codex login", async () => {