From 34d0105a4cfbdd938e5327500ef16e55e7fd0869 Mon Sep 17 00:00:00 2001 From: chziyue Date: Sat, 21 Mar 2026 02:22:51 +0000 Subject: [PATCH] Add test for Stop button during tool execution --- ui/src/ui/views/chat.test.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/ui/src/ui/views/chat.test.ts b/ui/src/ui/views/chat.test.ts index 8e0e18dcba9..ac3984e6e3d 100644 --- a/ui/src/ui/views/chat.test.ts +++ b/ui/src/ui/views/chat.test.ts @@ -527,6 +527,26 @@ describe("chat view", () => { expect(container.textContent).not.toContain("New session"); }); + it("shows a stop button when aborting is available during tool execution", () => { + const container = document.createElement("div"); + const onAbort = vi.fn(); + render( + renderChat( + createProps({ + canAbort: true, + sending: false, + onAbort, + }), + ), + container, + ); + + const stopButton = container.querySelector('button[title="Stop"]'); + expect(stopButton).not.toBeUndefined(); + stopButton?.dispatchEvent(new MouseEvent("click", { bubbles: true })); + expect(onAbort).toHaveBeenCalledTimes(1); + }); + it("shows a new session button when aborting is unavailable", () => { const container = document.createElement("div"); const onNewSession = vi.fn();