diff --git a/ui/src/components/task-chat/TaskChatComposer.test.tsx b/ui/src/components/task-chat/TaskChatComposer.test.tsx index 482e2f8ca3f..80fb83920f4 100644 --- a/ui/src/components/task-chat/TaskChatComposer.test.tsx +++ b/ui/src/components/task-chat/TaskChatComposer.test.tsx @@ -633,6 +633,40 @@ describe("TaskChatComposer", () => { ); }); + it("can clear the current assignee from the searchable combobox", async () => { + const onAdd = vi.fn().mockResolvedValue(undefined); + render( + , + ); + + const trigger = container.querySelector('[data-testid="task-chat-composer-assignee"]'); + flushSync(() => trigger?.click()); + await flushAsync(); + + const noAssigneeOption = Array.from( + document.body.querySelectorAll('button[type="button"]'), + ).find((button) => button !== trigger && button.textContent?.includes("No assignee")); + expect(noAssigneeOption).not.toBeUndefined(); + + flushSync(() => noAssigneeOption?.click()); + await new Promise((resolve) => requestAnimationFrame(() => resolve())); + typeText("Please unassign this."); + pressKey("Enter", { metaKey: true }); + await flushAsync(); + + expect(onAdd).toHaveBeenCalledWith( + "Please unassign this.", + undefined, + { assigneeAgentId: null, assigneeUserId: null }, + ); + }); + describe("draft persistence", () => { const draftKey = "task-chat-draft:issue-1";