mirror of
https://github.com/atom/atom.git
synced 2026-01-24 06:18:03 -05:00
Move specs of fold interactions with backspace/delete/insertText methods to edit-session-spec
This commit is contained in:
@@ -607,6 +607,13 @@ describe "EditSession", ->
|
||||
expect(selection2.isEmpty()).toBeTruthy()
|
||||
expect(selection2.cursor.getBufferPosition()).toEqual [2, 3]
|
||||
|
||||
describe "when there is a selection that ends on a folded line", ->
|
||||
it "destroys the selection", ->
|
||||
editSession.createFold(2,4)
|
||||
editSession.setSelectedBufferRange([[1,0], [2,0]])
|
||||
editSession.insertText('holy cow')
|
||||
expect(editSession.screenLineForRow(2).fold).toBeUndefined()
|
||||
|
||||
describe "when auto-indent is enabled", ->
|
||||
beforeEach ->
|
||||
editSession.setAutoIndent(true)
|
||||
@@ -833,6 +840,13 @@ describe "EditSession", ->
|
||||
editSession.backspace()
|
||||
expect(editSession.buffer.lineForRow(0)).toBe 'var qsort = function () {'
|
||||
|
||||
describe "when the selection ends on a folded line", ->
|
||||
it "destroys the fold", ->
|
||||
editSession.createFold(2,4)
|
||||
editSession.setSelectedBufferRange([[1,0], [2,0]])
|
||||
editSession.backspace()
|
||||
expect(editSession.screenLineForRow(2).fold).toBeUndefined()
|
||||
|
||||
describe "when there are multiple selections", ->
|
||||
it "removes all selected text", ->
|
||||
editSession.setSelectedBufferRanges([[[0,4], [0,13]], [[0,16], [0,24]]])
|
||||
@@ -884,6 +898,18 @@ describe "EditSession", ->
|
||||
editSession.delete()
|
||||
expect(buffer.lineForRow(12)).toBe '};'
|
||||
|
||||
describe "when the cursor is on a folded line", ->
|
||||
it "removes the lines contained by the fold", ->
|
||||
editSession.createFold(2,4)
|
||||
editSession.createFold(2,6)
|
||||
oldLine7 = buffer.lineForRow(7)
|
||||
oldLine8 = buffer.lineForRow(8)
|
||||
|
||||
editSession.setSelectedBufferRange([[2, 0], [2, 0]])
|
||||
editSession.delete()
|
||||
expect(editSession.screenLineForRow(2).text).toBe oldLine7
|
||||
expect(editSession.screenLineForRow(3).text).toBe oldLine8
|
||||
|
||||
describe "when there are multiple cursors", ->
|
||||
describe "when cursors are on the same line", ->
|
||||
it "removes the characters following each cursor", ->
|
||||
|
||||
@@ -64,31 +64,3 @@ describe "Selection", ->
|
||||
selection.selectToScreenPosition([0, 25])
|
||||
expect(selection.isReversed()).toBeFalsy()
|
||||
|
||||
describe "when the selection ends on the begining of a fold line", ->
|
||||
beforeEach ->
|
||||
editor.createFold(2,4)
|
||||
editor.createFold(2,6)
|
||||
|
||||
describe "inserting text", ->
|
||||
it "destroys the fold", ->
|
||||
selection.setBufferRange([[1,0], [2,0]])
|
||||
editor.insertText('holy cow')
|
||||
expect(editor.screenLineForRow(3).text).toBe buffer.lineForRow(3)
|
||||
|
||||
describe "backspace", ->
|
||||
it "destroys the fold", ->
|
||||
selection.setBufferRange([[1,0], [2,0]])
|
||||
selection.backspace()
|
||||
expect(editor.screenLineForRow(3).text).toBe buffer.lineForRow(3)
|
||||
|
||||
describe "when the selection is empty", ->
|
||||
describe "delete, when the selection is empty", ->
|
||||
it "removes the lines contained by the fold", ->
|
||||
oldLine7 = buffer.lineForRow(7)
|
||||
oldLine8 = buffer.lineForRow(8)
|
||||
|
||||
selection.setBufferRange([[2, 0], [2, 0]])
|
||||
selection.delete()
|
||||
expect(editor.screenLineForRow(2).text).toBe oldLine7
|
||||
expect(editor.screenLineForRow(3).text).toBe oldLine8
|
||||
|
||||
|
||||
Reference in New Issue
Block a user