   describe "replacing", ->
     beforeEach ->
       editor.setCursorBufferPosition([2,0])
-      editorView.trigger 'find-and-replace:show-replace'
+      atom.commands.dispatch editorView, 'find-and-replace:show-replace'
 
       waitsForPromise ->
         activationPromise


          runs ->
            atom.commands.dispatch(findView.findEditor[0], 'find-and-replace:find-next')
            expect(atom.workspaceView.getActiveView().find('.highlight.find-result')).toHaveLength 6
            expect(atom.workspaceView.getActiveView().find('.highlight.current-result')).toHaveLength 1

      describe "when all active pane items are closed", ->
        it "updates the result count", ->
          editorView.trigger 'core:close'
          expect(findView.resultCounter.text()).toEqual('no results')

      describe "when the active pane item is not an edit session", ->

          runs ->
            expect(findView.resultCounter.text()).toEqual('no results')

      describe "when a new edit session is activated on a different pane", ->
        it "initially highlights all the sample.js results", ->
          expect(getResultDecorations(editor, 'find-result')).toHaveLength 6

        it "reruns the search on the new editor", ->
          newEditor = null
