       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()


      rootView = new RootView(rootDirPath)
      project = rootView.project
      treeView = new TreeView(rootView)
      treeView.root = treeView.root
      dirView = treeView.root.entries.find('.directory:contains(test-dir)').view()
      dirView.expand()
      fileView = treeView.find('.file:contains(test-file.txt)').view()

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

    beforeEach ->
      rootView.deactivate()

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