Move cutToEndOfLine specs to edit-session-spec

This commit is contained in:
Nathan Sobo
2012-06-12 10:18:18 -06:00
parent 89f180524a
commit 5f263e63f0
2 changed files with 20 additions and 21 deletions

View File

@@ -786,6 +786,26 @@ describe "EditSession", ->
expect($native.readFromPasteboard()).toBe 'quicksort\nsort'
describe ".cutToEndOfLine()", ->
describe "when nothing is selected", ->
it "cuts up to the end of the line", ->
editSession.setCursorBufferPosition([2, 20])
editSession.addCursorAtBufferPosition([3, 20])
editSession.cutToEndOfLine()
expect(buffer.lineForRow(2)).toBe ' if (items.length'
expect(buffer.lineForRow(3)).toBe ' var pivot = item'
expect(pasteboard).toBe ' <= 1) return items;\ns.shift(), current, left = [], right = [];'
describe "when text is selected", ->
it "only cuts the selected text, not to the end of the line", ->
editSession.setSelectedBufferRanges([[[2,20], [2, 30]], [[3, 20], [3, 20]]])
editSession.cutToEndOfLine()
expect(buffer.lineForRow(2)).toBe ' if (items.lengthurn items;'
expect(buffer.lineForRow(3)).toBe ' var pivot = item'
expect(pasteboard).toBe ' <= 1) ret\ns.shift(), current, left = [], right = [];'
describe ".copySelectedText()", ->
it "copies selected text onto the clipboard", ->
editSession.copySelectedText()

View File

@@ -1554,27 +1554,6 @@ describe "Editor", ->
spyOn($native, 'writeToPasteboard').andCallFake (text) -> pasteboard = text
spyOn($native, 'readFromPasteboard').andCallFake -> pasteboard
describe "when nothing is selected", ->
it "cuts up to the end of the line", ->
editor.setCursorBufferPosition([2, 20])
editor.addCursorAtBufferPosition([3, 20])
editor.trigger 'cut-to-end-of-line'
expect(buffer.lineForRow(2)).toBe ' if (items.length'
expect(buffer.lineForRow(3)).toBe ' var pivot = item'
expect(pasteboard).toBe ' <= 1) return items;\ns.shift(), current, left = [], right = [];'
describe "when text is selected", ->
it "only cuts the selected text, not to the end of the line", ->
editor.setSelectedBufferRanges([[[2,20], [2, 30]], [[3, 20], [3, 20]]])
editor.trigger 'cut-to-end-of-line'
expect(buffer.lineForRow(2)).toBe ' if (items.lengthurn items;'
expect(buffer.lineForRow(3)).toBe ' var pivot = item'
expect(pasteboard).toBe ' <= 1) ret\ns.shift(), current, left = [], right = [];'
describe "undo/redo", ->
it "undoes/redoes the last change", ->