feat: support ctrl+c dismissal in ask flow

This commit is contained in:
Erik Kotsiuba
2026-04-19 16:32:27 +02:00
parent 0386239f5e
commit fcd1f1bce5
7 changed files with 72 additions and 0 deletions
+25
View File
@@ -7,6 +7,7 @@ import {
applyNumberShortcut,
cancelFlow,
confirmCurrentSelection,
dismissFlow,
enterOptionNoteMode,
enterQuestionNoteMode,
moveOption,
@@ -473,3 +474,27 @@ test("escape cancels from main flow but only exits input and note modes when edi
assert.equal(state.view.kind, "navigate");
assert.equal(state.cancelled, false);
});
test("dismissFlow cancels the tool even from editing modes", () => {
let state = createInitialState({
questions: [
{ id: "q", prompt: "Q?", options: [{ value: "a", label: "A" }] },
],
});
state = applyNumberShortcut(state, 2);
assert.equal(state.view.kind, "input");
state = dismissFlow(state);
assert.equal(state.cancelled, true);
assert.equal(state.completed, true);
state = createInitialState({
questions: [
{ id: "q", prompt: "Q?", options: [{ value: "a", label: "A" }] },
],
});
state = enterQuestionNoteMode(state, "q");
assert.equal(state.view.kind, "note");
state = dismissFlow(state);
assert.equal(state.cancelled, true);
assert.equal(state.completed, true);
});