       treeView.find('.directory:contains(zed)').click()
       sampleJs.click()
       newRootView = RootView.deserialize(rootView.serialize())
+      rootView.deactivate() # Deactivates previous TreeView
+
       newRootView.activateExtension(TreeView)
 
       newTreeView = newRootView.find(".tree-view").view()

      expect(newTreeView).toExist()
      expect(newTreeView.selectedEntry()).toMatchSelector(".file:contains(sample.js)")
      expect(newTreeView.find(".directory:contains(zed)")).toHaveClass("expanded")
      newRootView.remove()

    it "restores the focus state of the tree view", ->
      rootView.attachToDom()

    [dirView, fileView, rootDirPath, dirPath, filePath] = []

    beforeEach ->
      rootView.deactivate()

      rootDirPath = "/tmp/atom-tests"
      fs.remove(rootDirPath) if fs.exists(rootDirPath)
