mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Text is selected when mouse is moved after double click
This commit is contained in:
@@ -385,6 +385,37 @@ describe "Editor", ->
|
||||
expect(range.end).toEqual({row: 5, column: 27})
|
||||
expect(editor.getCursorPosition()).toEqual(row: 5, column: 27)
|
||||
|
||||
fit "creates a selection from the initial double click to mouse cursor's location ", ->
|
||||
editor.attachToDom()
|
||||
editor.css(position: 'absolute', top: 10, left: 10)
|
||||
|
||||
# double click
|
||||
[pageX, pageY] = window.pixelPositionForPoint(editor, [4, 10])
|
||||
editor.lines.trigger mousedownEvent({pageX, pageY, originalEvent: {detail: 1}})
|
||||
$(document).trigger 'mouseup'
|
||||
editor.lines.trigger mousedownEvent({pageX, pageY, originalEvent: {detail: 2}})
|
||||
|
||||
# moving changes selection
|
||||
[pageX, pageY] = window.pixelPositionForPoint(editor, [5, 27])
|
||||
editor.lines.trigger mousemoveEvent({pageX, pageY})
|
||||
|
||||
range = editor.selection.getRange()
|
||||
expect(range.start).toEqual({row: 4, column: 10})
|
||||
expect(range.end).toEqual({row: 5, column: 27})
|
||||
expect(editor.getCursorPosition()).toEqual(row: 5, column: 27)
|
||||
|
||||
# mouse up may occur outside of editor, but still need to halt selection
|
||||
$(document).trigger 'mouseup'
|
||||
|
||||
# moving after mouse up should not change selection
|
||||
[pageX, pageY] = window.pixelPositionForPoint(editor, [8, 8])
|
||||
editor.lines.trigger mousemoveEvent({pageX, pageY})
|
||||
|
||||
range = editor.selection.getRange()
|
||||
expect(range.start).toEqual({row: 4, column: 10})
|
||||
expect(range.end).toEqual({row: 5, column: 27})
|
||||
expect(editor.getCursorPosition()).toEqual(row: 5, column: 27)
|
||||
|
||||
describe "buffer manipulation", ->
|
||||
describe "when text input events are triggered on the hidden input element", ->
|
||||
describe "when there is no selection", ->
|
||||
|
||||
Reference in New Issue
Block a user