diff --git a/orchestrator/src/client/pages/orchestrator/AutomaticRunTab.test.tsx b/orchestrator/src/client/pages/orchestrator/AutomaticRunTab.test.tsx index bd28f73..c227a3a 100644 --- a/orchestrator/src/client/pages/orchestrator/AutomaticRunTab.test.tsx +++ b/orchestrator/src/client/pages/orchestrator/AutomaticRunTab.test.tsx @@ -1,5 +1,5 @@ import { createAppSettings } from "@shared/testing/factories.js"; -import { render, screen, waitFor } from "@testing-library/react"; +import { fireEvent, render, screen, waitFor } from "@testing-library/react"; import type React from "react"; import { describe, expect, it, vi } from "vitest"; import { AutomaticRunTab } from "./AutomaticRunTab"; @@ -155,4 +155,33 @@ describe("AutomaticRunTab", () => { "Set a Glassdoor city in Advanced settings to enable Glassdoor.", ); }); + + it("does not remove existing search terms when Backspace is pressed on an empty input", () => { + render( + , + ); + + const input = screen.getByPlaceholderText("Type and press Enter"); + fireEvent.keyDown(input, { key: "Backspace" }); + + expect( + screen.getByRole("button", { name: "Remove backend engineer" }), + ).toBeInTheDocument(); + expect( + screen.getByRole("button", { name: "Remove frontend engineer" }), + ).toBeInTheDocument(); + }); }); diff --git a/orchestrator/src/client/pages/orchestrator/AutomaticRunTab.tsx b/orchestrator/src/client/pages/orchestrator/AutomaticRunTab.tsx index 720e66a..7efd2d7 100644 --- a/orchestrator/src/client/pages/orchestrator/AutomaticRunTab.tsx +++ b/orchestrator/src/client/pages/orchestrator/AutomaticRunTab.tsx @@ -479,15 +479,6 @@ export const AutomaticRunTab: React.FC = ({ setValue("searchTermDraft", ""); return; } - if ( - event.key === "Backspace" && - searchTermDraft.length === 0 && - searchTerms.length > 0 - ) { - setValue("searchTerms", searchTerms.slice(0, -1), { - shouldDirty: true, - }); - } }} onBlur={() => { addSearchTerms(searchTermDraft);