From e889e85e2a9729e2cdf2989f062f80b757cfdedf Mon Sep 17 00:00:00 2001 From: Luke Pommersheim Date: Thu, 6 Aug 2015 16:18:33 +0200 Subject: [PATCH] CR: use array style syntax for bufferRanges --- spec/text-editor-spec.coffee | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index 0ff4368dd..3e72f4e0a 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -1916,24 +1916,20 @@ describe "TextEditor", -> describe "when there is only one line selected", -> it "moves the line up by one row", -> editor.setSelectedBufferRange([[3, 2], [3, 9]]) - expect(editor.getSelectedBufferRange()).toEqual {start: {row: 3, column: 2}, end: {row: 3, column: 9}} + expect(editor.getSelectedBufferRange()).toEqual [[3, 2], [3, 9]] editor.moveLineUp() - expect(editor.getSelectedBufferRange()).toEqual {start: {row: 2, column: 2}, end: {row: 2, column: 9}} + expect(editor.getSelectedBufferRange()).toEqual [[2, 2], [2, 9]] describe "when there is multiple selections", -> - it "moves the selected lines up by one row", -> editor.setSelectedBufferRanges([[[1, 2], [1, 9]], [[3, 2], [3, 9]], [[5, 2], [5, 9]]]) expect(editor.getSelectedBufferRanges()).toEqual [[[1, 2], [1, 9]], [[3, 2], [3, 9]], [[5, 2], [5, 9]]] editor.moveLineUp() - expect(editor.getSelectedBufferRanges()).toEqual [ - {start: {row: 0, column: 2}, end: {row: 0, column: 9}}, - {start: {row: 2, column: 2}, end: {row: 2, column: 9}}, - {start: {row: 4, column: 2}, end: {row: 4, column: 9}} ] + expect(editor.getSelectedBufferRanges()).toEqual [[[0, 2], [0, 9]], [[2, 2], [2, 9]], [[4, 2], [4, 9]]] describe "when there is multiple lines selected and moved upward until the top-most line is at row 0", -> it "moves all the lines upward until the top-most is at row 0, then no more lines are moved upward", -> @@ -1943,20 +1939,17 @@ describe "TextEditor", -> editor.moveLineUp() editor.moveLineUp() - expect(editor.getSelectedBufferRanges()).toEqual [ - {start: {row: 0, column: 2}, end: {row: 0, column: 9}}, - {start: {row: 2, column: 2}, end: {row: 2, column: 9}}, - {start: {row: 4, column: 2}, end: {row: 4, column: 9}} ] + expect(editor.getSelectedBufferRanges()).toEqual [[[0, 2], [0, 9]], [[2, 2], [2, 9]], [[4, 2], [4, 9]]] describe ".moveLineDown", -> describe "when there is only one line selected", -> it "moves the line down by one row", -> editor.setSelectedBufferRange([[3, 2], [3, 9]]) - expect(editor.getSelectedBufferRange()).toEqual {start: {row: 3, column: 2}, end: {row: 3, column: 9}} + expect(editor.getSelectedBufferRange()).toEqual [[3, 2], [3, 9]] editor.moveLineDown() - expect(editor.getSelectedBufferRange()).toEqual {start: {row: 4, column: 2}, end: {row: 4, column: 9}} + expect(editor.getSelectedBufferRange()).toEqual [[4, 2], [4, 9]] describe "when there is multiple selections", -> it "moves the selected lines down by one row", -> @@ -1966,27 +1959,18 @@ describe "TextEditor", -> editor.moveLineDown() - expect(editor.getSelectedBufferRanges()).toEqual [ - {start: {row: 6, column: 2}, end: {row: 6, column: 9}}, - {start: {row: 4, column: 2}, end: {row: 4, column: 9}}, - {start: {row: 2, column: 2}, end: {row: 2, column: 9}}] + expect(editor.getSelectedBufferRanges()).toEqual [[[6, 2], [6, 9]], [[4, 2], [4, 9]], [[2, 2], [2, 9]]] describe "when there is multiple lines selected and moved downward until the bottom-most line is at the last row", -> it "moves all the lines downward until the bottom-most is at bottom row, then no lines are moved downward", -> editor.setSelectedBufferRanges([[[7, 2], [7, 5]], [[8, 2], [8, 9]], [[11, 2], [11, 5]]]) - expect(editor.getSelectedBufferRanges()).toEqual [ - {start: {row: 7, column: 2}, end: {row: 7, column: 5}}, - {start: {row: 8, column: 2}, end: {row: 8, column: 9}}, - {start: {row: 11, column: 2}, end: {row: 11, column: 5}}] + expect(editor.getSelectedBufferRanges()).toEqual [[[7, 2], [7, 5]], [[8, 2], [8, 9]], [[11, 2], [11, 5]]] editor.moveLineDown() editor.moveLineDown() - expect(editor.getSelectedBufferRanges()).toEqual [ - {start: {row: 12, column: 2}, end: {row: 12, column: 5}}, - {start: {row: 9, column: 2}, end: {row: 9, column: 9}}, - {start: {row: 8, column: 2}, end: {row: 8, column: 5}}] + expect(editor.getSelectedBufferRanges()).toEqual [[[12, 2], [12, 5]], [[9, 2], [9, 9]], [[8, 2], [8, 5]]] describe ".insertText(text)", -> describe "when there is a single selection", ->