diff --git a/spec/app/edit-session-spec.coffee b/spec/app/edit-session-spec.coffee index 4ecbb0d31..3ba8bf882 100644 --- a/spec/app/edit-session-spec.coffee +++ b/spec/app/edit-session-spec.coffee @@ -576,6 +576,30 @@ describe "EditSession", -> expect(selection2.isEmpty()).toBeTruthy() expect(selection2.cursor.getBufferPosition()).toEqual [2, 3] + describe "when auto-indent is enabled", -> + beforeEach -> + editSession.setAutoIndent(true) + + describe "when editing a wrapped line", -> + beforeEach -> + editSession.setSoftWrapColumn(50) + + describe "when newline is inserted", -> + it "indents cursor based on the indentation of previous buffer line", -> + editSession.setCursorBufferPosition([4, 29]) + editSession.insertText("\n") + expect(editSession.buffer.lineForRow(5)).toEqual(" ") + + describe "when text that closes a scope is entered", -> + it "outdents the text", -> + editSession.setCursorBufferPosition([4, 29]) + editSession.insertText("\n") + expect(editSession.buffer.lineForRow(5)).toEqual(" ") + editSession.insertText("}") + expect(editSession.buffer.lineForRow(5)).toEqual(" }") + expect(editSession.getCursorBufferPosition().column).toBe 5 + + describe ".insertNewline()", -> describe "when there is a single cursor", -> describe "when the cursor is at the beginning of a line", -> diff --git a/spec/app/editor-spec.coffee b/spec/app/editor-spec.coffee index a5d0d4cfa..93db7b0ab 100644 --- a/spec/app/editor-spec.coffee +++ b/spec/app/editor-spec.coffee @@ -1089,26 +1089,6 @@ describe "Editor", -> position = editor.pixelPositionForScreenPosition([6,1]) expect(scrollHandler).toHaveBeenCalledWith(position) - describe "when editing a line that spans multiple screen lines", -> - beforeEach -> - editor.setSoftWrap(true, 50) - editor.setAutoIndent(true) - - describe "when newline is inserted", -> - it "indents cursor based on the indentation of previous buffer line", -> - editor.setCursorBufferPosition([4, 29]) - editor.insertText("\n") - expect(editor.buffer.lineForRow(5)).toEqual(" ") - - describe "when text that closes a scope is entered", -> - it "outdents the text", -> - editor.setCursorBufferPosition([4, 29]) - editor.insertText("\n") - expect(editor.buffer.lineForRow(5)).toEqual(" ") - editor.insertText("}") - expect(editor.buffer.lineForRow(5)).toEqual(" }") - expect(editor.getCursorBufferPosition().column).toBe 5 - describe "selection", -> selection = null