mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
Move the copy event test to editor, make selection test copy implementation
This commit is contained in:
@@ -511,4 +511,14 @@ describe "Editor", ->
|
||||
expect(editor.clipPosition(row: 1, column: 10000)).toEqual(row: 1, column: buffer.getLine(1).length)
|
||||
expect(editor.clipPosition(row: 1, column: -5)).toEqual(row: 1, column: 0)
|
||||
|
||||
describe "cut, copy & paste", ->
|
||||
describe "when a copy event is triggered", ->
|
||||
beforeEach ->
|
||||
editor.getSelection().setRange new Range([0,4], [0, 13])
|
||||
atom.native.writeToPasteboard('first')
|
||||
expect(atom.native.readFromPasteboard()).toBe 'first'
|
||||
|
||||
it "copies selected text onto the clipboard", ->
|
||||
editor.trigger "copy"
|
||||
expect(atom.native.readFromPasteboard()).toBe 'quicksort'
|
||||
|
||||
|
||||
@@ -125,16 +125,16 @@ describe "Selection", ->
|
||||
|
||||
it "places selected text on the clipboard", ->
|
||||
selection.setRange new Range([0,4], [0,13])
|
||||
editor.trigger "copy"
|
||||
selection.copy()
|
||||
expect(atom.native.readFromPasteboard()).toBe 'quicksort'
|
||||
|
||||
selection.setRange new Range([0,4], [3,13])
|
||||
editor.trigger "copy"
|
||||
selection.copy()
|
||||
expect(atom.native.readFromPasteboard()).toBe "quicksort = function () {\n var sort = function(items) {\n if (items.length <= 1) return items;\n var pivot"
|
||||
|
||||
it "places nothing on the clipboard when there is no selection", ->
|
||||
selection.setRange new Range([0,4], [0,4])
|
||||
editor.trigger "copy"
|
||||
selection.copy()
|
||||
expect(atom.native.readFromPasteboard()).toBe 'first'
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user