Move selectWord specs to edit-session-spec

This commit is contained in:
Nathan Sobo
2012-06-12 16:25:50 -06:00
parent b44a0b69a9
commit 0e592b0e7a
2 changed files with 25 additions and 25 deletions

View File

@@ -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]]

View File

@@ -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])