           expect(dragStartEvent.dataTransfer.getData("text/uri-list")).toEqual "file://#{editor1.getPath()}"
 
     describe "when a tab is dragged to another Atom window", ->
+      beforeEach ->
+        spyOn(pane, 'destroyItem').andCallThrough()
+
       it "closes the tab in the first window and opens the tab in the second window", ->
         [dragStartEvent, dropEvent] = buildDragEvents(tabBar.tabAtIndex(1).element, tabBar.tabAtIndex(0).element)
         tabBar.onDragStart(dragStartEvent)
-        tabBar.onDropOnOtherWindow(pane.id, 1)
-
-        expect(pane.getItems()).toEqual [item1, item2]
-        expect(pane.getActiveItem()).toBe item2
-
-        dropEvent.dataTransfer.setData('from-window-id', tabBar.getWindowId() + 1)
-
-        spyOn(tabBar, 'moveItemBetweenPanes').andCallThrough()
-        tabBar.onDrop(dropEvent)
+        atom.getCurrentWindow().webContents.send('tab:dropped', pane.id, 1)
+
+        # Can't spy on onDropOnOtherWindow since it's binded
+        waitsFor 'dragged pane item to be destroyed', ->
+          pane.destroyItem.callCount is 1
+
+        runs ->
+          expect(pane.getItems()).toEqual [item1, item2]
+          expect(pane.getActiveItem()).toBe item2
+
+          dropEvent.dataTransfer.setData('from-window-id', tabBar.getWindowId() + 1)
+
+          spyOn(tabBar, 'moveItemBetweenPanes').andCallThrough()
+          tabBar.onDrop(dropEvent)
 
         waitsFor ->
           tabBar.moveItemBetweenPanes.callCount > 0

        editor1.setText('I came from another window')
        [dragStartEvent, dropEvent] = buildDragEvents(tabBar.tabAtIndex(1).element, tabBar.tabAtIndex(0).element)
        tabBar.onDragStart(dragStartEvent)
        tabBar.onDropOnOtherWindow(pane.id, 1)

        dropEvent.dataTransfer.setData('from-window-id', tabBar.getWindowId() + 1)

        spyOn(tabBar, 'moveItemBetweenPanes').andCallThrough()
        tabBar.onDrop(dropEvent)

        waitsFor ->
          tabBar.moveItemBetweenPanes.callCount > 0


        [dragStartEvent, dropEvent] = buildDragEvents(tabBar.tabAtIndex(1).element, tabBar.tabAtIndex(0).element)
        tabBar.onDragStart(dragStartEvent)
        atom.getCurrentWindow().webContents.send('tab:dropped', pane.id, 1)

        # Can't spy on onDropOnOtherWindow since it's binded
        waitsFor 'dragged pane item to be destroyed', ->
          pane.destroyItem.callCount is 1

        runs ->
          dropEvent.dataTransfer.setData('from-window-id', tabBar.getWindowId() + 1)

          spyOn(tabBar, 'moveItemBetweenPanes').andCallThrough()
          tabBar.onDrop(dropEvent)

        waitsFor ->
          tabBar.moveItemBetweenPanes.callCount > 0
