mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Cursor can be re-positioned with the mouse
This commit is contained in:
@@ -262,6 +262,21 @@ describe "Editor", ->
|
||||
|
||||
expect(editor.getCursorPosition()).toEqual(lastPosition)
|
||||
|
||||
describe "when a click event occurs in the editor", ->
|
||||
it "re-positions the cursor to the clicked row / column", ->
|
||||
editor.attachToDom()
|
||||
editor.css(position: 'absolute', top: 10, left: 10)
|
||||
pageX = editor.offset().left + 10 * editor.charWidth + 3
|
||||
pageY = editor.offset().top + 4 * editor.lineHeight - 2
|
||||
|
||||
expect(editor.getCursorPosition()).toEqual(row: 0, column: 0)
|
||||
|
||||
editor.lines.trigger clickEvent({pageX, pageY})
|
||||
|
||||
expect(editor.getCursorPosition()).toEqual(row: 3, column: 10)
|
||||
|
||||
|
||||
|
||||
describe "selection bindings", ->
|
||||
selection = null
|
||||
|
||||
|
||||
@@ -28,6 +28,9 @@ eventPropertiesFromPattern = (pattern) ->
|
||||
window.keydownEvent = (pattern, properties={}) ->
|
||||
$.Event "keydown", _.extend(eventPropertiesFromPattern(pattern), properties)
|
||||
|
||||
window.clickEvent = (properties={}) ->
|
||||
$.Event "click", properties
|
||||
|
||||
window.waitsForPromise = (fn) ->
|
||||
window.waitsFor (moveOn) ->
|
||||
fn().done(moveOn)
|
||||
|
||||
Reference in New Issue
Block a user