mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Add specs
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user