         beforeEach ->
           dotFilePath = path.join(dirPath, ".dotfile")
           fs.writeFileSync(dotFilePath, "dot")
-          dirView.collapse()
-          dirView.expand()
+          dirView[0].collapse()
+          dirView[0].expand()
           dotFileView = treeView.find('.file:contains(.dotfile)')
 
           waitsForFileToOpen ->

              expect(atom.workspace.getActivePaneItem().getPath()).not.toBe newPath
              expect(treeView.find(".tree-view")).toMatchSelector(':focus')
              expect(atom.workspaceView.getActiveView().isFocused).toBeFalsy()
              expect(dirView.find('.directory.selected:contains(new)').length).toBe(1)

        describe "when the path with a trailing '/' is changed and confirmed", ->
          describe "when no directory exists at the given path", ->

                expect(fs.existsSync(newPath)).toBeTruthy()
                expect(fs.existsSync(filePath)).toBeTruthy()
                expect(copyDialog.parent()).not.toExist()
                dirView = $(treeView.root.entries).find('.directory:contains(test-dir)')
                dirView[0].expand()
                expect($(dirView[0].entries).children().length).toBe 1
                expect(atom.workspace.getActiveEditor().getPath()).toBe(newPath)

          describe "when the directories along the new path don't exist", ->
