Add specs

This commit is contained in:
Ben Ogle
2014-07-11 17:03:42 -07:00
parent 381d5b91b2
commit 29e883cf36

View File

@@ -2081,6 +2081,20 @@ describe "Editor", ->
editor.indent()
expect(buffer.lineForRow(0)).toMatch(tabRegex)
it "respects the tab stops when cursor is in the middle of a tab", ->
editor.setTabLength(4)
buffer.insert([12, 2], "\n ")
editor.setCursorBufferPosition [13, 1]
editor.indent()
expect(buffer.lineForRow(13)).toMatch /^\s+$/
expect(buffer.lineForRow(13).length).toBe 4
expect(editor.getCursorBufferPosition()).toEqual [13, 4]
buffer.insert([13, 0], " ")
editor.setCursorBufferPosition [13, 6]
editor.indent()
expect(buffer.lineForRow(13).length).toBe 8
describe "if 'softTabs' is false", ->
it "insert a \t into the buffer", ->
editor.setSoftTabs(false)
@@ -2099,6 +2113,20 @@ describe "Editor", ->
expect(buffer.lineForRow(5).length).toBe 6
expect(editor.getCursorBufferPosition()).toEqual [5, 6]
it "respects the tab stops when cursor is in the middle of a tab", ->
editor.setTabLength(4)
buffer.insert([12, 2], "\n ")
editor.setCursorBufferPosition [13, 1]
editor.indent(autoIndent: true)
expect(buffer.lineForRow(13)).toMatch /^\s+$/
expect(buffer.lineForRow(13).length).toBe 4
expect(editor.getCursorBufferPosition()).toEqual [13, 4]
buffer.insert([13, 0], " ")
editor.setCursorBufferPosition [13, 6]
editor.indent(autoIndent: true)
expect(buffer.lineForRow(13).length).toBe 8
describe "when 'softTabs' is false", ->
it "moves the cursor to the end of the leading whitespace and inserts enough tabs to bring the line to the suggested level of indentaion", ->
convertToHardTabs(buffer)