       describe "when dropping on the top part of the header", ->
         it "should add the placeholder above the directory", ->
           # dropping gammaDir above alphaDir
-          alphaDir = $(treeView).find('.project-root:contains(alpha):first')
-          gammaDir = $(treeView).find('.project-root:contains(gamma):first')
+          alphaDir = treeView.roots[0]
+          gammaDir = treeView.roots[1]
           [dragStartEvent, dragDropEvents] =
-            eventHelpers.buildPositionalDragEvents(gammaDir.find('.project-root-header')[0], alphaDir[0], '.tree-view')
+            eventHelpers.buildPositionalDragEvents(gammaDir.querySelector('.project-root-header'), alphaDir, '.tree-view')
 
           treeView.rootDragAndDrop.onDragStart(dragStartEvent)
           treeView.rootDragAndDrop.onDrop(dragDropEvents.top)


      describe "when a file is modified", ->
        it "updates its and its parent directories' styles", ->
          expect(treeView.find('.file:contains(b.txt)')).toHaveClass 'status-modified'
          expect(treeView.find('.directory:contains(dir)')).toHaveClass 'status-modified'

      describe "when a file loses its modified status", ->
        it "updates its and its parent directories' styles", ->
          fs.writeFileSync(modifiedFile, originalFileContent)
          atom.project.getRepositories()[0].getPathStatus(modifiedFile)

          expect(treeView.find('.file:contains(b.txt)')).not.toHaveClass 'status-modified'
          expect(treeView.find('.directory:contains(dir)')).not.toHaveClass 'status-modified'

  describe "when the resize handle is double clicked", ->
    beforeEach ->
      treeView.width(10).find('.list-tree').width 100

    it "sets the width of the tree to be the width of the list", ->
      expect(treeView.width()).toBe 10
      treeView.find('.tree-view-resize-handle').trigger 'dblclick'
      expect(treeView.width()).toBeGreaterThan 10

      treeView.width(1000)
      treeView.find('.tree-view-resize-handle').trigger 'dblclick'
      expect(treeView.width()).toBeLessThan 1000

  describe "when other panels are added", ->
    beforeEach ->


      runs ->
        treeView = atom.workspace.getLeftPanels()[0].getItem()
        expect(treeView.element.querySelector('.tree-view')).toHaveFocus()

    it "restores the scroll top when toggled", ->
      workspaceElement.style.height = '5px'
