Skip to content

πŸ™Œ OpenHands: AI-Driven Development

fix: align agent settings save button label with other settings pages (#691)

Hiep Leeb9a01ed94bf
diff --git a/__tests__/routes/agent-settings.test.tsx b/__tests__/routes/agent-settings.test.tsx
index ba9ab5bb10..3c7968511f 100644
--- a/__tests__/routes/agent-settings.test.tsx
+++ b/__tests__/routes/agent-settings.test.tsx
@@ -60,6 +60,30 @@ describe("AgentSettingsScreen", () => {
expect(screen.queryByTestId("agent-command-input")).not.toBeInTheDocument();
});
+ it("labels the save button 'Save Changes' for consistency with other settings pages", async () => {
+ // Arrange β€” render with any valid settings; the label is independent
+ // of the form's state.
+ vi.spyOn(SettingsService, "getSettings").mockResolvedValue(
+ buildSettings({
+ agent_settings: {
+ ...MOCK_DEFAULT_USER_SETTINGS.agent_settings,
+ agent_kind: "openhands",
+ },
+ }),
+ );
+
+ // Act
+ renderAgentSettingsScreen();
+ await screen.findByTestId("agent-settings-screen");
+
+ // Assert β€” t() is stubbed to return the key, so the rendered text is
+ // the translation key. SETTINGS$SAVE_CHANGES = "Save Changes" in
+ // public/locales/en/openhands.json; BUTTON$SAVE = "Save" (the bug).
+ expect(screen.getByTestId("agent-save-button")).toHaveTextContent(
+ "SETTINGS$SAVE_CHANGES",
+ );
+ });
+
it("saves enable_sub_agents when toggling on the OpenHands path", async () => {
const user = userEvent.setup();
vi.spyOn(SettingsService, "getSettings").mockResolvedValue(
diff --git a/src/routes/agent-settings.tsx b/src/routes/agent-settings.tsx
index 2027358930..c769e6019f 100644
--- a/src/routes/agent-settings.tsx
+++ b/src/routes/agent-settings.tsx
@@ -377,7 +377,9 @@ function AgentSettingsScreen() {
isDisabled={isSaving || !effectiveIsDirty || isAcpInvalid}
onClick={handleSave}
>
- {isSaving ? t(I18nKey.SETTINGS$SAVING) : t(I18nKey.BUTTON$SAVE)}
+ {isSaving
+ ? t(I18nKey.SETTINGS$SAVING)
+ : t(I18nKey.SETTINGS$SAVE_CHANGES)}
</BrandButton>
</div>
</div>