Add test for moving lines up without last line ending

This commit is contained in:
jamsinclair
2016-10-12 10:22:25 +13:00
parent 443425733d
commit aabf472e95

View File

@@ -2693,6 +2693,22 @@ describe "TextEditor", ->
expect(editor.isFoldedAtBufferRow(6)).toBeFalsy()
expect(editor.lineTextForBufferRow(6)).toBe " if (items.length <= 1) return items;"
describe "when the last line of selection does not end with a valid line ending", ->
it "appends line ending to last line and moves the lines spanned by the selection to the preceeding row", ->
expect(editor.lineTextForBufferRow(9)).toBe " };"
expect(editor.lineTextForBufferRow(10)).toBe ""
expect(editor.lineTextForBufferRow(11)).toBe " return sort(Array.apply(this, arguments));"
expect(editor.lineTextForBufferRow(12)).toBe "};"
editor.setSelectedBufferRange([[10, 0], [12, 2]])
editor.moveLineUp()
expect(editor.getSelectedBufferRange()).toEqual [[9, 0], [11, 2]]
expect(editor.lineTextForBufferRow(9)).toBe ""
expect(editor.lineTextForBufferRow(10)).toBe " return sort(Array.apply(this, arguments));"
expect(editor.lineTextForBufferRow(11)).toBe "};"
expect(editor.lineTextForBufferRow(12)).toBe " };"
describe "when there are multiple selections", ->
describe "when all the selections span different lines", ->
describe "when there is no folds", ->