Skip to content

Commit 0f54c47

Browse files
dwc1997claude
andcommitted
test(ui): add regression tests for abort UI live guard
Add tests verifying Stop button visibility requires local active send/stream state, not just stale session-list abortability. Co-Authored-By: Claude Opus 4.8 <[email protected]>
1 parent 68d0250 commit 0f54c47

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

ui/src/ui/views/chat.test.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3388,3 +3388,43 @@ describe("chat session controls", () => {
33883388
expect(thinkingSelect.title).toContain("Adaptive");
33893389
});
33903390
});
3391+
3392+
describe("abort UI live guard (regression #87387)", () => {
3393+
it("hides Stop button when canAbort is true but isBusy is false", () => {
3394+
// Simulates the bug: stale session-list state keeps canAbort true after
3395+
// response completes (stream is null, sending is false).
3396+
const container = renderChatView({
3397+
canAbort: true,
3398+
sending: false,
3399+
stream: null,
3400+
runStatus: null,
3401+
});
3402+
3403+
// Stop button should NOT be visible when there's no active send/stream
3404+
expect(container.querySelector(".chat-send-btn--stop")).toBeNull();
3405+
});
3406+
3407+
it("shows Stop button when canAbort is true and isBusy is true", () => {
3408+
const container = renderChatView({
3409+
canAbort: true,
3410+
sending: false,
3411+
stream: "data",
3412+
runStatus: null,
3413+
});
3414+
3415+
// Stop button SHOULD be visible when there's an active stream
3416+
expect(container.querySelector(".chat-send-btn--stop")).not.toBeNull();
3417+
});
3418+
3419+
it("shows Stop button when sending is true", () => {
3420+
const container = renderChatView({
3421+
canAbort: true,
3422+
sending: true,
3423+
stream: null,
3424+
runStatus: null,
3425+
});
3426+
3427+
// Stop button SHOULD be visible when sending is in progress
3428+
expect(container.querySelector(".chat-send-btn--stop")).not.toBeNull();
3429+
});
3430+
});

0 commit comments

Comments
 (0)