Move some auto indent specs to edit-session-spec

This commit is contained in:
Nathan Sobo
2012-06-12 15:19:40 -06:00
parent b895122c24
commit 918b8d95da
2 changed files with 24 additions and 20 deletions

View File

@@ -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", ->

View File

@@ -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