mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Allow scrollPastEnd to be set from the editor
This commit is contained in:
@@ -647,17 +647,6 @@ describe "TextEditorPresenter", ->
|
||||
expectStateUpdate presenter, -> atom.config.set("editor.scrollPastEnd", false)
|
||||
expect(getState(presenter).verticalScrollbar.scrollHeight).toBe presenter.contentHeight
|
||||
|
||||
it "doesn't add the computed clientHeight to the computed scrollHeight if editor.scrollPastEnd is true but the presenter is created with scrollPastEnd as false", ->
|
||||
presenter = buildPresenter(scrollTop: 10, explicitHeight: 50, horizontalScrollbarHeight: 10, scrollPastEnd: false)
|
||||
expectStateUpdate presenter, -> presenter.setScrollTop(300)
|
||||
expect(getState(presenter).verticalScrollbar.scrollHeight).toBe presenter.contentHeight
|
||||
|
||||
expectStateUpdate presenter, -> atom.config.set("editor.scrollPastEnd", true)
|
||||
expect(getState(presenter).verticalScrollbar.scrollHeight).toBe presenter.contentHeight
|
||||
|
||||
expectStateUpdate presenter, -> atom.config.set("editor.scrollPastEnd", false)
|
||||
expect(getState(presenter).verticalScrollbar.scrollHeight).toBe presenter.contentHeight
|
||||
|
||||
describe ".scrollTop", ->
|
||||
it "tracks the value of ::scrollTop", ->
|
||||
presenter = buildPresenter(scrollTop: 10, explicitHeight: 20, horizontalScrollbarHeight: 10)
|
||||
|
||||
@@ -5689,6 +5689,40 @@ describe "TextEditor", ->
|
||||
editor.selectPageUp()
|
||||
expect(editor.getSelectedBufferRanges()).toEqual [[[0, 0], [12, 2]]]
|
||||
|
||||
describe "scroll past end", ->
|
||||
it "returns the scrollPastEnd setting on the editor instance if set, or 'editor.scrollPastEnd' otherwise", ->
|
||||
atom.config.set('editor.scrollPastEnd', true)
|
||||
expect(editor.getScrollPastEnd()).toBe(true)
|
||||
|
||||
atom.config.set('editor.scrollPastEnd', false)
|
||||
expect(editor.getScrollPastEnd()).toBe(false)
|
||||
|
||||
editor.setScrollPastEnd(true)
|
||||
expect(editor.getScrollPastEnd()).toBe(true)
|
||||
|
||||
atom.config.set('editor.scrollPastEnd', true)
|
||||
atom.config.set('editor.scrollPastEnd', false)
|
||||
expect(editor.getScrollPastEnd()).toBe(true)
|
||||
|
||||
it "emits a onDidChangeScrollPastEnd event when it changes", ->
|
||||
scrollPastEndSpy = jasmine.createSpy('onDidChangeScrollPastEnd')
|
||||
editor.onDidChangeScrollPastEnd(scrollPastEndSpy)
|
||||
|
||||
atom.config.set('editor.scrollPastEnd', true)
|
||||
expect(scrollPastEndSpy).toHaveBeenCalled()
|
||||
|
||||
scrollPastEndSpy.reset()
|
||||
editor.setScrollPastEnd(false)
|
||||
expect(scrollPastEndSpy).toHaveBeenCalled()
|
||||
|
||||
scrollPastEndSpy.reset()
|
||||
editor.setScrollPastEnd(false)
|
||||
expect(scrollPastEndSpy).not.toHaveBeenCalled()
|
||||
|
||||
atom.config.set('editor.scrollPastEnd', false)
|
||||
atom.config.set('editor.scrollPastEnd', true)
|
||||
expect(scrollPastEndSpy).not.toHaveBeenCalled()
|
||||
|
||||
describe "::setFirstVisibleScreenRow() and ::getFirstVisibleScreenRow()", ->
|
||||
beforeEach ->
|
||||
line = Array(9).join('0123456789')
|
||||
|
||||
Reference in New Issue
Block a user