mirror of
https://github.com/atom/atom.git
synced 2026-01-25 14:59:03 -05:00
Port .selectLinesContainingCursors() specs
This commit is contained in:
@@ -3393,6 +3393,19 @@ describe "TextEditorComponent", ->
|
||||
afterEach ->
|
||||
atom.themes.removeStylesheet("test")
|
||||
|
||||
describe "when selecting lines containing cursors", ->
|
||||
it "autoscrolls to the selection", ->
|
||||
editor.setCursorScreenPosition([5, 6])
|
||||
nextAnimationFrame()
|
||||
|
||||
wrapperNode.scrollToTop()
|
||||
nextAnimationFrame()
|
||||
expect(wrapperNode.getScrollTop()).toBe 0
|
||||
|
||||
editor.selectLinesContainingCursors()
|
||||
nextAnimationFrame()
|
||||
expect(wrapperNode.getScrollBottom()).toBe (7 + editor.getVerticalScrollMargin()) * 10
|
||||
|
||||
describe "moving cursors", ->
|
||||
it "scrolls down when the last cursor gets closer than ::verticalScrollMargin to the bottom of the editor", ->
|
||||
expect(wrapperNode.getScrollTop()).toBe 0
|
||||
|
||||
@@ -1194,20 +1194,6 @@ describe "TextEditor", ->
|
||||
editor.selectLinesContainingCursors()
|
||||
expect(editor.getSelectedBufferRange()).toEqual [[1, 0], [4, 0]]
|
||||
|
||||
it "autoscrolls to the selection", ->
|
||||
editor.setLineHeightInPixels(10)
|
||||
editor.setDefaultCharWidth(10)
|
||||
editor.setHeight(50)
|
||||
editor.setWidth(50)
|
||||
editor.setHorizontalScrollbarHeight(0)
|
||||
editor.setCursorScreenPosition([5, 6])
|
||||
|
||||
editor.scrollToTop()
|
||||
expect(editor.getScrollTop()).toBe 0
|
||||
|
||||
editor.selectLinesContainingCursors()
|
||||
expect(editor.getScrollBottom()).toBe (7 + editor.getVerticalScrollMargin()) * 10
|
||||
|
||||
describe ".selectToBeginningOfWord()", ->
|
||||
it "selects text from cusor position to beginning of word", ->
|
||||
editor.setCursorScreenPosition [0, 13]
|
||||
|
||||
@@ -231,6 +231,12 @@ class TextEditorElement extends HTMLElement
|
||||
setScrollBottom: (scrollBottom) ->
|
||||
@component.setScrollBottom(scrollBottom)
|
||||
|
||||
scrollToTop: ->
|
||||
@setScrollTop(0)
|
||||
|
||||
scrollToBottom: ->
|
||||
@setScrollBottom(Infinity)
|
||||
|
||||
getScrollTop: ->
|
||||
@component.getScrollTop()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user