This commit is contained in:
Katrina Uychaco 2016-01-09 17:26:44 -08:00
parent 2d00163e18
commit d0be1965f2

View File

@ -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]