Create custom jQuery event for shift select on gutter

This commit is contained in:
Kevin Sawicki
2012-12-26 10:53:02 -08:00
parent 708cdbf7b5
commit 14e5dde418

View File

@@ -1992,13 +1992,17 @@ describe "Editor", ->
expect(editor.getText()).toBe(originalPathText)
describe "when clicking a gutter line", ->
it "moves the cursor to the start of the selected line", ->
beforeEach ->
rootView.attachToDom()
it "moves the cursor to the start of the selected line", ->
expect(editor.getCursorScreenPosition()).toEqual [0,0]
editor.gutter.find(".line-number:eq(1)").trigger 'click'
expect(editor.getCursorScreenPosition()).toEqual [1,0]
it "selects to the start of the selected line when shift is pressed", ->
expect(editor.getSelection().getScreenRange()).toEqual [0,0], [0,0]
editor.gutter.find(".line-number:eq(1)").trigger 'click', {shiftKey: true}
expect(editor.getSelection().getScreenRange()).toEqual [0,0], [1,0]
expect(editor.getSelection().getScreenRange()).toEqual [[0,0], [0,0]]
event = $.Event("click")
event.shiftKey = true
editor.gutter.find(".line-number:eq(1)").trigger event
expect(editor.getSelection().getScreenRange()).toEqual [[0,0], [1,0]]