Add spec for clicking past last line

This commit is contained in:
Kevin Sawicki
2014-10-16 17:16:18 -07:00
parent 8c136b18c2
commit 5069a5b48b

View File

@@ -1230,6 +1230,22 @@ describe "TextEditorComponent", ->
beforeEach ->
linesNode = componentNode.querySelector('.lines')
describe "when the mouse is clicked below the last line", ->
it "moves the cursor to the end of file buffer position", ->
editor.setText('foo')
editor.setCursorBufferPosition([0, 0])
height = 4.5 * lineHeightInPixels
wrapperNode.style.height = height + 'px'
wrapperNode.style.width = 10 * charWidth + 'px'
component.measureHeightAndWidth()
nextAnimationFrame()
coordinates = clientCoordinatesForScreenPosition([0, 2])
coordinates.clientY = height * 2
linesNode.dispatchEvent(buildMouseEvent('mousedown', coordinates))
nextAnimationFrame()
expect(editor.getCursorScreenPosition()).toEqual [0, 3]
describe "when a non-folded line is single-clicked", ->
describe "when no modifier keys are held down", ->
it "moves the cursor to the nearest screen position", ->