mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-22 16:51:28 +02:00
Hide unwired question cancel action
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
5d2ea93efe
commit
83826a3ddb
2 files changed
+36
-15
No files matched your search
@@ -91,6 +91,25 @@ describe("IssueThreadInteractionCard", () => {
|
||||
expect(host.querySelectorAll('[role="checkbox"]')).toHaveLength(3);
|
||||
});
|
||||
|
||||
it("only shows question cancellation when a cancel handler is wired", () => {
|
||||
const withoutHandler = renderCard({
|
||||
interaction: pendingAskUserQuestionsInteraction,
|
||||
onSubmitInteractionAnswers: vi.fn(),
|
||||
});
|
||||
expect(withoutHandler.textContent).not.toContain("Cancel question");
|
||||
|
||||
act(() => root?.unmount());
|
||||
withoutHandler.remove();
|
||||
root = null;
|
||||
|
||||
const withHandler = renderCard({
|
||||
interaction: pendingAskUserQuestionsInteraction,
|
||||
onCancelInteraction: vi.fn(),
|
||||
onSubmitInteractionAnswers: vi.fn(),
|
||||
});
|
||||
expect(withHandler.textContent).toContain("Cancel question");
|
||||
});
|
||||
|
||||
it("makes child tasks explicit in suggested task trees", () => {
|
||||
const host = renderCard({
|
||||
interaction: pendingSuggestedTasksInteraction,
|
||||
|
||||
@@ -792,21 +792,23 @@ function AskUserQuestionsCard({
|
||||
Submit once after you finish the full form.
|
||||
</div>
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
disabled={!onCancelInteraction || working || cancelling}
|
||||
onClick={() => void handleCancel()}
|
||||
>
|
||||
{cancelling ? (
|
||||
<>
|
||||
<Loader2 className="mr-2 h-3.5 w-3.5 animate-spin" />
|
||||
Cancelling...
|
||||
</>
|
||||
) : (
|
||||
"Cancel question"
|
||||
)}
|
||||
</Button>
|
||||
{onCancelInteraction ? (
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
disabled={working || cancelling}
|
||||
onClick={() => void handleCancel()}
|
||||
>
|
||||
{cancelling ? (
|
||||
<>
|
||||
<Loader2 className="mr-2 h-3.5 w-3.5 animate-spin" />
|
||||
Cancelling...
|
||||
</>
|
||||
) : (
|
||||
"Cancel question"
|
||||
)}
|
||||
</Button>
|
||||
) : null}
|
||||
<Button
|
||||
size="sm"
|
||||
disabled={!onSubmitInteractionAnswers || !canSubmit || working || cancelling}
|
||||
|
||||
Reference in new issue
Block a user