diff --git a/test/cmd_line/command.test.ts b/test/cmd_line/command.test.ts index a3e3a202dac3..5fb256394bb1 100644 --- a/test/cmd_line/command.test.ts +++ b/test/cmd_line/command.test.ts @@ -93,4 +93,46 @@ suite('cmd_line/search command', () => { assert.equal(statusBar, '/|123', 'Failed to retain the text on the right of the cursor'); await modeHandler.handleKeyEvent(''); }); + + // TODO: and tests + + test(' deletes from cursor to first character', async () => { + await modeHandler.handleMultipleKeyEvents(':s/abc/xyz'.split('')); + await modeHandler.handleMultipleKeyEvents(['', '', '']); + const statusBar = StatusBar.Get().trim(); + assert.equal(statusBar, ':|yz'); + await modeHandler.handleKeyEvent(''); + }); + + test(' puts cursor at start of command line', async () => { + await modeHandler.handleMultipleKeyEvents(':s/abc/xyz'.split('')); + await modeHandler.handleKeyEvent(''); + const statusBar = StatusBar.Get().trim(); + assert.equal(statusBar, ':|s/abc/xyz'); + await modeHandler.handleKeyEvent(''); + }); + + test(' puts cursor at start of command line', async () => { + await modeHandler.handleMultipleKeyEvents(':s/abc/xyz'.split('')); + await modeHandler.handleKeyEvent(''); + const statusBar = StatusBar.Get().trim(); + assert.equal(statusBar, ':|s/abc/xyz'); + await modeHandler.handleKeyEvent(''); + }); + + test(' puts cursor at end of command line', async () => { + await modeHandler.handleMultipleKeyEvents(':s/abc/xyz'.split('')); + await modeHandler.handleMultipleKeyEvents(['', '']); + const statusBar = StatusBar.Get().trim(); + assert.equal(statusBar, ':s/abc/xyz|'); + await modeHandler.handleKeyEvent(''); + }); + + test(' puts cursor at end of command line', async () => { + await modeHandler.handleMultipleKeyEvents(':s/abc/xyz'.split('')); + await modeHandler.handleMultipleKeyEvents(['', '']); + const statusBar = StatusBar.Get().trim(); + assert.equal(statusBar, ':s/abc/xyz|'); + await modeHandler.handleKeyEvent(''); + }); });