diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index b892f59eb..699492ecc 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -96,23 +96,29 @@ describe "TextEditor", -> describe ".update()", -> it "updates the editor with the supplied config parameters", -> + element = editor.element # force element initialization atom.config.set('editor.showInvisibles', true) editor.onDidChange(changeSpy = jasmine.createSpy('onDidChange')) - editor.update({ + updatePromise = editor.update({ tabLength: 6, softTabs: false, softWrapped: true, editorWidthInChars: 40, ignoreInvisibles: true, mini: false, lineNumberGutterVisible: false, scrollPastEnd: true, autoHeight: false }) - expect(changeSpy.callCount).toBe(1) - expect(editor.getTabLength()).toBe(6) - expect(editor.getSoftTabs()).toBe(false) - expect(editor.isSoftWrapped()).toBe(true) - expect(editor.getEditorWidthInChars()).toBe(40) - expect(editor.getInvisibles()).toEqual({}) - expect(editor.isMini()).toBe(false) - expect(editor.isLineNumberGutterVisible()).toBe(false) - expect(editor.getScrollPastEnd()).toBe(true) - expect(editor.getAutoHeight()).toBe(false) + + waitsForPromise -> + updatePromise + + runs -> + expect(changeSpy.callCount).toBe(1) + expect(editor.getTabLength()).toBe(6) + expect(editor.getSoftTabs()).toBe(false) + expect(editor.isSoftWrapped()).toBe(true) + expect(editor.getEditorWidthInChars()).toBe(40) + expect(editor.getInvisibles()).toEqual({}) + expect(editor.isMini()).toBe(false) + expect(editor.isLineNumberGutterVisible()).toBe(false) + expect(editor.getScrollPastEnd()).toBe(true) + expect(editor.getAutoHeight()).toBe(false) describe "config defaults", -> it "uses the `editor.tabLength`, `editor.softWrap`, and `editor.softTabs`, and `core.fileEncoding` config values", -> diff --git a/src/text-editor.coffee b/src/text-editor.coffee index 560d06768..9fdc6bdd3 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -234,6 +234,11 @@ class TextEditor extends Model if resetDisplayLayer @resetDisplayLayer() + if @editorElement? + @editorElement.views.getNextUpdatePromise() + else + Promise.resolve() + serialize: -> tokenizedBufferState = @tokenizedBuffer.serialize()