Skip to content

Commit fccc704

Browse files
committed
test(web): cover the queue-follow-up branch of the running composer
Folding Pylon's queue affordance together with upstream's send fallback added precedence logic that nothing exercised: every existing case passes canQueueFollowUp: false, so only the fallback was covered — on origin/pylon too. Since supportsSessionInputQueueFollowUp defaults to true, the queue branch is what a running turn normally takes, which left the common path untested. Adds three cases: queue beside stop on a queue-capable provider, queue winning over the send fallback rather than both rendering, and the queue button staying visible but disabled with an empty composer.
1 parent f24578f commit fccc704

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

‎apps/web/src/components/chat/ComposerPrimaryActions.test.tsx‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,33 @@ function renderRunningActions(showSendWhileRunning: boolean, hasSendableContent:
9595
);
9696
}
9797

98+
function renderQueueCapableRunningActions(
99+
showSendWhileRunning: boolean,
100+
hasSendableContent: boolean,
101+
) {
102+
return renderToStaticMarkup(
103+
createElement(ComposerPrimaryActions, {
104+
compact: true,
105+
pendingAction: null,
106+
isRunning: true,
107+
canQueueFollowUp: true,
108+
onQueueFollowUp: () => {},
109+
showPlanFollowUpPrompt: false,
110+
promptHasText: hasSendableContent,
111+
isSendBusy: false,
112+
sendDisabledReason: null,
113+
isConnecting: false,
114+
isEnvironmentUnavailable: false,
115+
isPreparingWorktree: false,
116+
hasSendableContent,
117+
showSendWhileRunning,
118+
onPreviousPendingQuestion: () => {},
119+
onImplementPlanInNewThread: () => {},
120+
onInterrupt: () => {},
121+
}),
122+
);
123+
}
124+
98125
function renderSendButton() {
99126
return renderToStaticMarkup(
100127
createElement(ComposerPrimaryActions, {
@@ -270,4 +297,29 @@ describe("ComposerPrimaryActions", () => {
270297
expect(markup).toContain('aria-label="Stop generation"');
271298
expect(markup).not.toContain('aria-label="Send message"');
272299
});
300+
301+
// Most providers advertise a session input queue, so the queue affordance —
302+
// not the send fallback — is the path a running turn normally takes.
303+
it("offers queue follow-up beside stop while running on a queue-capable provider", () => {
304+
const markup = renderQueueCapableRunningActions(false, true);
305+
306+
expect(markup).toContain('aria-label="Stop generation"');
307+
expect(markup).toContain('aria-label="Queue follow-up"');
308+
expect(markup).not.toContain('aria-label="Send message"');
309+
});
310+
311+
it("prefers queue follow-up over the send fallback rather than offering both", () => {
312+
const markup = renderQueueCapableRunningActions(true, true);
313+
314+
expect(markup).toContain('aria-label="Queue follow-up"');
315+
expect(markup).not.toContain('aria-label="Send message"');
316+
});
317+
318+
it("keeps the queue affordance visible but disabled with an empty composer", () => {
319+
const markup = renderQueueCapableRunningActions(true, false);
320+
321+
expect(markup).toContain('aria-label="Queue follow-up"');
322+
expect(markup).toContain("disabled");
323+
expect(markup).not.toContain('aria-label="Send message"');
324+
});
273325
});

0 commit comments

Comments
 (0)