Merge 34d0105a4cfbdd938e5327500ef16e55e7fd0869 into 5e417b44e1540f528d2ae63e3e20229a902d1db2

This commit is contained in:
chziyue 2026-03-21 02:23:43 +00:00 committed by GitHub
commit 6796181fe8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 1 deletions

View File

@ -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<HTMLButtonElement>('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();

View File

@ -1299,7 +1299,7 @@ export function renderChat(props: ChatProps) {
</button>
${
canAbort && (isBusy || props.sending)
canAbort
? html`
<button class="chat-send-btn chat-send-btn--stop" @click=${props.onAbort} title="Stop">
${icons.stop}