X-Git-Url: https://git.r.bdr.sh/rbdr/dotfiles/blobdiff_plain/24c7594d62d8d7fbbcdb64b11ce4adc5d8e6991a..5d173e99d3e906b49ba3bde59388083b120d4e21:/atom/packages/vim-mode/spec/prefixes-spec.coffee diff --git a/atom/packages/vim-mode/spec/prefixes-spec.coffee b/atom/packages/vim-mode/spec/prefixes-spec.coffee index e782d20..71c4a12 100644 --- a/atom/packages/vim-mode/spec/prefixes-spec.coffee +++ b/atom/packages/vim-mode/spec/prefixes-spec.coffee @@ -11,8 +11,8 @@ describe "Prefixes", -> editorElement = element editor = editorElement.getModel() vimState = editorElement.vimState - vimState.activateCommandMode() - vimState.resetCommandMode() + vimState.activateNormalMode() + vimState.resetNormalMode() keydown = (key, options={}) -> options.element ?= editorElement @@ -146,3 +146,37 @@ describe "Prefixes", -> it "throws away anything written to it", -> vimState.setRegister('%', "new content") expect(vimState.getRegister('%').text).toEqual '/Users/atom/known_value.txt' + + describe "the ctrl-r command in insert mode", -> + beforeEach -> + editor.setText "02\n" + editor.setCursorScreenPosition [0, 0] + vimState.setRegister('"', text: '345') + vimState.setRegister('a', text: 'abc') + atom.clipboard.write "clip" + keydown 'a' + editor.insertText '1' + + it "inserts contents of the unnamed register with \"", -> + keydown 'r', ctrl: true + keydown '"' + expect(editor.getText()).toBe '013452\n' + + describe "when useClipboardAsDefaultRegister enabled", -> + it "inserts contents from clipboard with \"", -> + atom.config.set 'vim-mode.useClipboardAsDefaultRegister', true + keydown 'r', ctrl: true + keydown '"' + expect(editor.getText()).toBe '01clip2\n' + + it "inserts contents of the 'a' register", -> + keydown 'r', ctrl: true + keydown 'a' + expect(editor.getText()).toBe '01abc2\n' + + it "is cancelled with the escape key", -> + keydown 'r', ctrl: true + keydown 'escape' + expect(editor.getText()).toBe '012\n' + expect(vimState.mode).toBe "insert" + expect(editor.getCursorScreenPosition()).toEqual [0, 2]