From 0e592b0e7ac32a88cffc277071058dd63000fe38 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 12 Jun 2012 16:25:50 -0600 Subject: [PATCH] Move selectWord specs to edit-session-spec --- spec/app/edit-session-spec.coffee | 25 +++++++++++++++++++++++++ spec/app/selection-spec.coffee | 25 ------------------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/spec/app/edit-session-spec.coffee b/spec/app/edit-session-spec.coffee index 03eb55893..29751ff9c 100644 --- a/spec/app/edit-session-spec.coffee +++ b/spec/app/edit-session-spec.coffee @@ -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]] diff --git a/spec/app/selection-spec.coffee b/spec/app/selection-spec.coffee index 126b010e3..a8f6de495 100644 --- a/spec/app/selection-spec.coffee +++ b/spec/app/selection-spec.coffee @@ -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])