mirror of
https://github.com/atom/atom.git
synced 2026-01-25 06:48:28 -05:00
Move cutToEndOfLine specs to edit-session-spec
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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", ->
|
||||
|
||||
Reference in New Issue
Block a user