Iron out scheduling issues

* Ensure multiple calls to scheduleUpdate only result in a single call
to updateSync in the future.
* Explicit calls to update sync after scheduling an update fulfill the
scheduled update.
* Track whether we think the editor is visible or not to avoid redundant
didShow calls.
* Ensure we only update on resize events if the editor actually changed
size.
This commit is contained in:
Nathan Sobo
2017-02-23 21:30:35 -07:00
committed by Antonio Scandurra
parent 19d1d148eb
commit 583c2c537d
2 changed files with 33 additions and 11 deletions

View File

@@ -19,7 +19,11 @@ describe('TextEditorComponent', () => {
function buildComponent (params = {}) {
const buffer = new TextBuffer({text: SAMPLE_TEXT})
const editor = new TextEditor({buffer})
const component = new TextEditorComponent({model: editor, rowsPerTile: params.rowsPerTile})
const component = new TextEditorComponent({
model: editor,
rowsPerTile: params.rowsPerTile,
updatedSynchronously: false
})
const {element} = component
element.style.width = params.width ? params.width + 'px' : '800px'
element.style.height = params.height ? params.height + 'px' : '600px'