Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
Merge pull request #448 from atom/mb-allow-pane-close-to-be-async
Browse files Browse the repository at this point in the history
Tweak tests so that they work when Pane.close becomes async
  • Loading branch information
Max Brunsfeld authored Jun 1, 2017
2 parents d4f3d91 + c7cb3d1 commit 17341e0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
18 changes: 12 additions & 6 deletions spec/mru-list-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,19 @@ describe 'MRU List', ->
pane.splitDown()
expect(workspaceElement.querySelectorAll('.tabs-mru-switcher').length).toBe initialPaneCount + 2

pane = atom.workspace.getActivePane()
pane.close()
expect(workspaceElement.querySelectorAll('.tabs-mru-switcher').length).toBe initialPaneCount + 1
waitsForPromise ->
pane = atom.workspace.getActivePane()
Promise.resolve(pane.close())

pane = atom.workspace.getActivePane()
pane.close()
expect(workspaceElement.querySelectorAll('.tabs-mru-switcher').length).toBe initialPaneCount
runs ->
expect(workspaceElement.querySelectorAll('.tabs-mru-switcher').length).toBe initialPaneCount + 1

waitsForPromise ->
pane = atom.workspace.getActivePane()
Promise.resolve(pane.close())

runs ->
expect(workspaceElement.querySelectorAll('.tabs-mru-switcher').length).toBe initialPaneCount

it "Doesn't build list until activated for the first time", ->
expect(workspaceElement.querySelectorAll('.tabs-mru-switcher').length).toBe initialPaneCount
Expand Down
5 changes: 3 additions & 2 deletions spec/tabs-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -722,8 +722,9 @@ describe "TabBarView", ->
tab2 = tabBar2.tabAtIndex(0)
spyOn(tab2, 'destroy')

pane2.close()
expect(tab2.destroy).toHaveBeenCalled()
waitsForPromise ->
Promise.resolve(pane2.close()).then ->
expect(tab2.destroy).toHaveBeenCalled()

describe "dragging and dropping tabs", ->
describe "when a tab is dragged within the same pane", ->
Expand Down

0 comments on commit 17341e0

Please sign in to comment.