diff --git a/spec/app/edit-session-spec.coffee b/spec/app/edit-session-spec.coffee index 7c7ceec16..42d0947a1 100644 --- a/spec/app/edit-session-spec.coffee +++ b/spec/app/edit-session-spec.coffee @@ -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() diff --git a/spec/app/editor-spec.coffee b/spec/app/editor-spec.coffee index 5c10670e9..82553630b 100644 --- a/spec/app/editor-spec.coffee +++ b/spec/app/editor-spec.coffee @@ -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", ->