         spyOn(editor, 'scan').andCallThrough()
 
         editor.setText('no matches in here')
-        editor.buffer.emit('contents-modified')
+        advanceClock(editor.buffer.stoppedChangingDelay)
 
         expect(editor.scan).not.toHaveBeenCalled()
 


        # updates when there are no matches
        editor.setText('no matches in here')
        editor.buffer.emit('contents-modified')

        expect(resultAddedSpy.callCount).toBe 2
        expect(resultRemovedSpy.callCount).toBe 1

        editor = atom.workspaceView.getActiveView().editor
        editor.setText('items\nitems')
        spyOn(editor, 'scan').andCallThrough()
        advanceClock(editor.buffer.stoppedChangingDelay)
        expect(editor.scan).not.toHaveBeenCalled()

  describe "cancelling a search", ->
