Correctly autoscroll if a horizontal scrollbar appears in the same frame

This commit is contained in:
Nathan Sobo
2017-03-15 12:57:46 -06:00
committed by Antonio Scandurra
parent 5d82dcf87a
commit 5c7208751f
2 changed files with 45 additions and 13 deletions

View File

@@ -404,6 +404,21 @@ describe('TextEditorComponent', () => {
expect(scroller.scrollLeft).toBe(component.getScrollWidth() - scroller.clientWidth)
})
it('accounts for the presence of horizontal scrollbars that appear during the same frame as the autoscroll', async () => {
const {component, element, editor} = buildComponent()
const {scroller} = component.refs
element.style.height = component.getScrollHeight() + 'px'
element.style.width = component.getScrollWidth() + 'px'
await component.getNextUpdatePromise()
editor.setCursorScreenPosition([10, Infinity])
editor.insertText('\n\n' + 'x'.repeat(100))
await component.getNextUpdatePromise()
expect(scroller.scrollTop).toBe(component.getScrollHeight() - scroller.clientHeight)
expect(scroller.scrollLeft).toBe(component.getScrollWidth() - scroller.clientWidth)
})
})
describe('line and line number decorations', () => {