diff --git a/spec/mru-list-spec.coffee b/spec/mru-list-spec.coffee index e5140da9..c55d2b64 100644 --- a/spec/mru-list-spec.coffee +++ b/spec/mru-list-spec.coffee @@ -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 diff --git a/spec/tabs-spec.coffee b/spec/tabs-spec.coffee index 5e23817f..1025b25f 100644 --- a/spec/tabs-spec.coffee +++ b/spec/tabs-spec.coffee @@ -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", ->