+ beforeEach ->
+ editor.setCursorScreenPosition([0, 0])
+ atom.commands.dispatch(editorElement, "editor:move-to-end-of-line")
+
+ it "allows the cursor to be placed on the \\n character", ->
+ expect(editor.getCursorScreenPosition()).toEqual [0, 6]
+
+ it "puts the editor into normal mode when <escape> is pressed", ->
+ keydown('escape')
+
+ expect(editorElement.classList.contains('normal-mode')).toBe(true)
+ expect(editorElement.classList.contains('insert-mode')).toBe(false)
+ expect(editorElement.classList.contains('visual-mode')).toBe(false)
+
+ it "puts the editor into normal mode when <ctrl-c> is pressed", ->
+ helpers.mockPlatform(editorElement, 'platform-darwin')
+ keydown('c', ctrl: true)
+ helpers.unmockPlatform(editorElement)
+
+ expect(editorElement.classList.contains('normal-mode')).toBe(true)
+ expect(editorElement.classList.contains('insert-mode')).toBe(false)
+ expect(editorElement.classList.contains('visual-mode')).toBe(false)
+
+ describe "replace-mode", ->
+ describe "with content", ->
+ beforeEach -> editor.setText("012345\n\nabcdef")
+
+ describe "when cursor is in the middle of the line", ->
+ beforeEach ->
+ editor.setCursorScreenPosition([0, 3])
+ keydown('R', shift: true)
+
+ it "moves the cursor to the left when exiting replace mode", ->
+ keydown('escape')
+ expect(editor.getCursorScreenPosition()).toEqual [0, 2]
+
+ describe "when cursor is at the beginning of line", ->
+ beforeEach ->
+ editor.setCursorScreenPosition([1, 0])
+ keydown('R', shift: true)
+
+ it "leaves the cursor at the beginning of line", ->
+ keydown('escape')
+ expect(editor.getCursorScreenPosition()).toEqual [1, 0]
+
+ describe "on a line with content", ->
+ beforeEach ->
+ keydown('R', shift: true)
+ editor.setCursorScreenPosition([0, 0])
+ atom.commands.dispatch(editorElement, "editor:move-to-end-of-line")