feat: support ctrl+c dismissal in ask flow
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user