From fa86d2d1568c326900953b247aae3679e170a07b Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Thu, 24 Dec 2015 17:57:08 -0800 Subject: [PATCH] Add tests for pending status --- spec/text-editor-spec.coffee | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index 02d2e4a96..c51ec41d7 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -5804,3 +5804,20 @@ describe "TextEditor", -> screenRange: marker1.getRange(), rangeIsReversed: false } + + describe "pending state", -> + editor1 = null + beforeEach -> + waitsForPromise -> + atom.workspace.open('sample.txt', pending: true).then (o) -> editor1 = o + + it "should open file in pending state if 'pending' option is true", -> + expect(editor1.isPending()).toBe true + expect(editor.isPending()).toBe false # By default pending status is false + + it "invokes ::onDidTerminatePendingState observers if pending status is removed", -> + events = [] + editor1.onDidTerminatePendingState (event) -> events.push(event) + editor1.terminatePendingState() + expect(editor1.isPending()).toBe false + expect(events).toEqual [editor1]