From d0be1965f245832d2f205e0a7441e4defd494c84 Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Sat, 9 Jan 2016 17:26:44 -0800 Subject: [PATCH] :art: --- spec/text-editor-spec.coffee | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index 2e85870e6..8976c1b51 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -5807,28 +5807,31 @@ describe "TextEditor", -> describe "pending state", -> editor1 = null + events = null + beforeEach -> waitsForPromise -> atom.workspace.open('sample.txt', pending: true).then (o) -> editor1 = o + runs -> + events = [] + editor1.onDidTerminatePendingState (event) -> events.push(event) + it "does not open file in pending state by default", -> expect(editor.isPending()).toBe false it "opens file in pending state if 'pending' option is true", -> expect(editor1.isPending()).toBe true - it "invokes ::onDidTerminatePendingState observers if pending status is removed", -> - events = [] - editor1.onDidTerminatePendingState (event) -> events.push(event) + it "terminates pending state if ::terminatePendingState is invoked", -> editor1.terminatePendingState() + expect(editor1.isPending()).toBe false expect(events).toEqual [editor1] it "terminates pending state when buffer is changed", -> - events = [] - editor1.onDidTerminatePendingState (event) -> events.push(event) - expect(editor1.isPending()).toBe true editor1.insertText('I\'ll be back!') advanceClock(500) + expect(editor1.isPending()).toBe false expect(events).toEqual [editor1]