diff --git a/spec/app/edit-session-spec.coffee b/spec/app/edit-session-spec.coffee index 1ef3af65f..a03989c04 100644 --- a/spec/app/edit-session-spec.coffee +++ b/spec/app/edit-session-spec.coffee @@ -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", -> diff --git a/spec/app/selection-spec.coffee b/spec/app/selection-spec.coffee index 6253846ea..d79e0919a 100644 --- a/spec/app/selection-spec.coffee +++ b/spec/app/selection-spec.coffee @@ -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 -