           expect(atom.project.scan.argsForCall[0][0]).toEqual /i\(\\w\)ems\+/gi
 
       it "shows an error when the regex pattern is invalid", ->
-        projectFindView.trigger 'project-find:toggle-regex-option'
+        atom.commands.dispatch(projectFindView[0], 'project-find:toggle-regex-option')
         projectFindView.findEditor.setText('[')
-        projectFindView.trigger 'core:confirm'
+        atom.commands.dispatch(projectFindView[0], 'core:confirm')
 
         waitsForPromise ->
           searchPromise

    describe "when project-find:confirm is triggered", ->
      it "displays the results and no errors", ->
        projectFindView.findEditor.setText('items')
        projectFindView.trigger 'project-find:confirm'

        waitsForPromise ->
          searchPromise

        runs ->
          expect(atom.project.scan).toHaveBeenCalled()
          atom.project.scan.reset()
          atom.commands.dispatch(projectFindView[0], 'core:confirm')

        waitsForPromise ->
          searchPromise
