@@ -1559,6 +1559,28 @@ describe("ui rendering", () => {
15591559 }
15601560 });
15611561
1562+ test("Escape while running blurs the input first and a second Escape aborts", () => {
1563+ const state = createTestState();
1564+ state.running = true;
1565+ state.abortController = new AbortController();
1566+
1567+ try {
1568+ const controller = createInputController(state);
1569+ const base = expectVStack(renderBaseLayout(state, 80, controller));
1570+
1571+ controller.onBlur();
1572+
1573+ const input = expectTextInput(renderInputArea(state.theme, controller));
1574+ expect(input.props.focused).toBe(false);
1575+ expect(state.abortController.signal.aborted).toBe(false);
1576+
1577+ base.props.onKeyPress?.("escape");
1578+ expect(state.abortController.signal.aborted).toBe(true);
1579+ } finally {
1580+ state.db.close();
1581+ }
1582+ });
1583+
15621584 test("Tab autocompletes the last file path in normal input mode", () => {
15631585 const state = createTestState();
15641586 const cwd = createTempDir();