From 4931609d4ba0109cafd60cc934653ba0749243c5 Mon Sep 17 00:00:00 2001 From: Machiste Quintana Date: Sun, 3 May 2015 22:55:55 -0400 Subject: [PATCH] Add specs for moveSelectionLeft() --- spec/text-editor-spec.coffee | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index 53eb32acb..df87a29e4 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -3427,6 +3427,36 @@ describe "TextEditor", -> expect(cursor1.getBufferPosition()).toEqual [0, 0] expect(cursor3.getBufferPosition()).toEqual [1, 2] + describe ".moveSelectionLeft()", -> + it "moves one active selection on one line one column to the left", -> + editor.setSelectedBufferRange [[0, 4], [0, 13]] + expect(editor.getSelectedText()).toBe 'quicksort' + editor.moveSelectionLeft() + expect(editor.getSelectedText()).toBe 'quicksort' + expect(editor.getSelectedBufferRange()).toEqual [[0, 3], [0, 12]] + + it "moves multiple active selections on one line one column to the left", -> + editor.setSelectedBufferRanges([[[0, 4], [0, 13]], [[0, 16], [0, 24]]]) + selections = editor.getSelections() + + expect(selections[0].getText()).toBe 'quicksort' + expect(selections[1].getText()).toBe 'function' + editor.moveSelectionLeft() + expect(selections[0].getText()).toBe 'quicksort' + expect(selections[1].getText()).toBe 'function' + expect(editor.getSelectedBufferRanges()).toEqual [[[0, 3], [0, 12]], [[0, 15], [0, 23]]] + + it "moves multiple active selections on multiple lines one column to the left", -> + editor.setSelectedBufferRanges([[[0, 4], [0, 13]], [[1, 6], [1, 10]]]) + selections = editor.getSelections() + + expect(selections[0].getText()).toBe 'quicksort' + expect(selections[1].getText()).toBe 'sort' + editor.moveSelectionLeft() + expect(selections[0].getText()).toBe 'quicksort' + expect(selections[1].getText()).toBe 'sort' + expect(editor.getSelectedBufferRanges()).toEqual [[[0, 3], [0, 12]], [[1, 5], [1, 9]]] + describe 'reading text', -> it '.lineTextForScreenRow(row)', -> editor.foldBufferRow(4)