mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
Move selectWord specs to edit-session-spec
This commit is contained in:
@@ -497,6 +497,31 @@ describe "EditSession", ->
|
||||
expect(selection2.getBufferRange()).toEqual [[3,48], [3,50]]
|
||||
expect(selection2.isReversed()).toBeFalsy()
|
||||
|
||||
describe ".selectWord()", ->
|
||||
describe "when the cursor is inside a word", ->
|
||||
it "selects the entire word", ->
|
||||
editSession.setCursorScreenPosition([0, 8])
|
||||
editSession.selectWord()
|
||||
expect(editSession.getSelectedText()).toBe 'quicksort'
|
||||
|
||||
describe "when the cursor is on beginning of a word", ->
|
||||
it "selects the entire word", ->
|
||||
editSession.setCursorScreenPosition([0, 4])
|
||||
editSession.selectWord()
|
||||
expect(editSession.getSelectedText()).toBe 'quicksort'
|
||||
|
||||
describe "when the cursor is at the end of a word", ->
|
||||
it "selects the entire word", ->
|
||||
editSession.setCursorScreenPosition([0, 13])
|
||||
editSession.selectWord()
|
||||
expect(editSession.getSelectedText()).toBe 'quicksort'
|
||||
|
||||
describe "when the cursor is not on a word", ->
|
||||
it "selects nothing", ->
|
||||
editSession.setCursorScreenPosition([5, 2])
|
||||
editSession.selectWord()
|
||||
expect(editSession.getSelectedText()).toBe ''
|
||||
|
||||
describe "when the cursor is moved while there is a selection", ->
|
||||
makeSelection = -> selection.setBufferRange [[1, 2], [1, 5]]
|
||||
|
||||
|
||||
@@ -137,31 +137,6 @@ describe "Selection", ->
|
||||
expect(selectionView.regions.length).toBe 3
|
||||
expect(selectionView.find('.selection').length).toBe 3
|
||||
|
||||
describe ".selectWord()", ->
|
||||
describe "when the cursor is inside a word", ->
|
||||
it "selects the entire word", ->
|
||||
editor.setCursorScreenPosition [0,8]
|
||||
selection.selectWord()
|
||||
expect(selection.getText()).toBe 'quicksort'
|
||||
|
||||
describe "when the cursor is on beginning of a word", ->
|
||||
it "selects the entire word", ->
|
||||
editor.setCursorScreenPosition [0,4]
|
||||
selection.selectWord()
|
||||
expect(selection.getText()).toBe 'quicksort'
|
||||
|
||||
describe "when the cursor is at the end of a word", ->
|
||||
it "selects the entire word", ->
|
||||
editor.setCursorScreenPosition [0,13]
|
||||
selection.selectWord()
|
||||
expect(selection.getText()).toBe 'quicksort'
|
||||
|
||||
describe "when the cursor is not on a word", ->
|
||||
it "selects nothing", ->
|
||||
editor.setCursorScreenPosition [5,2]
|
||||
selection.selectWord()
|
||||
expect(selection.getText()).toBe ''
|
||||
|
||||
describe ".isReversed()", ->
|
||||
it "returns true if the cursor precedes the anchor", ->
|
||||
selection.cursor.setScreenPosition([0, 20])
|
||||
|
||||
Reference in New Issue
Block a user