💄 use array-shorthand instead of new Range

This commit is contained in:
Kevin Sawicki & Nathan Sobo
2013-07-22 18:39:46 -06:00
parent 844469a9a7
commit 73adc40c4e

View File

@@ -1,5 +1,4 @@
EditSession = require 'edit-session'
{Range} = require 'telepath'
describe "Selection", ->
[buffer, editSession, selection] = []
@@ -15,18 +14,18 @@ describe "Selection", ->
describe ".deleteSelectedText()", ->
describe "when nothing is selected", ->
it "deletes nothing", ->
selection.setBufferRange new Range([0,3], [0,3])
selection.setBufferRange [[0,3], [0,3]]
selection.deleteSelectedText()
expect(buffer.lineForRow(0)).toBe "var quicksort = function () {"
describe "when one line is selected", ->
it "deletes selected text and clears the selection", ->
selection.setBufferRange new Range([0,4], [0,14])
selection.setBufferRange [[0,4], [0,14]]
selection.deleteSelectedText()
expect(buffer.lineForRow(0)).toBe "var = function () {"
endOfLine = buffer.lineForRow(0).length
selection.setBufferRange new Range([0,0], [0, endOfLine])
selection.setBufferRange [[0,0], [0, endOfLine]]
selection.deleteSelectedText()
expect(buffer.lineForRow(0)).toBe ""
@@ -34,7 +33,7 @@ describe "Selection", ->
describe "when multiple lines are selected", ->
it "deletes selected text and clears the selection", ->
selection.setBufferRange new Range([0,1], [2,39])
selection.setBufferRange [[0,1], [2,39]]
selection.deleteSelectedText()
expect(buffer.lineForRow(0)).toBe "v;"
expect(selection.isEmpty()).toBeTruthy()