From 76eacd835f359cfa49761c536f2fbd1f4b12cdb1 Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Tue, 2 Jul 2024 16:59:46 -0400 Subject: [PATCH] Add test for quit command --- src/common/all_test.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/common/all_test.ts b/src/common/all_test.ts index c9a2065..1b9b5c1 100644 --- a/src/common/all_test.ts +++ b/src/common/all_test.ts @@ -415,8 +415,17 @@ const EditorTest = { assertTrue(res); }, '.processKeyPress - ctrl-q': async () => { + // Dirty file (Need to clear confirmation messages) const e = new Editor(defaultTerminalSize); - const res = await e.processKeyPress(Fn.ctrlKey('q')); + await e.processKeyPress('d'); + assertTrue(await e.processKeyPress(Fn.ctrlKey('q'))); + assertTrue(await e.processKeyPress(Fn.ctrlKey('q'))); + assertTrue(await e.processKeyPress(Fn.ctrlKey('q'))); + assertFalse(await e.processKeyPress(Fn.ctrlKey('q'))); + + // Clean file + const e2 = new Editor(defaultTerminalSize); + const res = await e2.processKeyPress(Fn.ctrlKey('q')); assertFalse(res); }, };