               expect(addDialog.errorMessage.textContent).toContain 'already exists'
               expect(addDialog.element).toHaveClass('error')
               expect(atom.workspace.getModalPanels()[0]).toBe addPanel
-              expect(handlers['file-created'][0]).not.toHaveBeenCalled()
+              expect(callback).not.toHaveBeenCalled()
 
           describe "when the project has no path", ->
             it "adds a file and closes the dialog", ->

          expect(atom.notifications.getNotifications()[0].getDetail()).toContain 'ENOENT: no such file or directory'

    describe "tree-view:add-file", ->
      [addPanel, addDialog, handlers] = []

      beforeEach ->
        jasmine.attachToDOM(workspaceElement)

        handlers = treeView.emitter.handlersByEventName
        treeView.onFileCreated ->
        spyOn(handlers['file-created'], '0')

        waitsForFileToOpen ->
          fileView.dispatchEvent(new MouseEvent('click', {bubbles: true, detail: 1}))

            runs ->
              expect(fs.isFileSync(newPath)).toBeTruthy()
              expect(atom.workspace.getActivePaneItem().getPath()).toBe newPath
              expect(callback).toHaveBeenCalledWith({path: newPath})

      describe "when a directory is selected", ->
        it "opens an add dialog with the directory's path populated", ->
