           atom.keymaps.handleKeyboardEvent(key)
 
           # Check for result
-          expect(editor.getBuffer().getLastLine()).toEqual "function"
+          expect(editor.getBuffer().getLastLine()).toEqual('function')
 
           # Check for cursor position
           bufferPosition = editor.getCursorBufferPosition()
-          expect(bufferPosition.row).toEqual 13
-          expect(bufferPosition.column).toEqual 8
+          expect(bufferPosition.row).toEqual(13)
+          expect(bufferPosition.column).toEqual(8)
 
         it "does not insert the word when enter completion not enabled", ->
-          expect(editorView.querySelector(".autocomplete-plus")).not.toExist()
+          expect(editorView.querySelector('.autocomplete-plus')).not.toExist()
 
           # Trigger an autocompletion
-          triggerAutocompletion editor
-          advanceClock completionDelay
+          triggerAutocompletion(editor)
+          advanceClock(completionDelay)
 
           autocompleteView = atom.views.getView(autocompleteManager)
           # Accept suggestion

  beforeEach ->
    runs ->
      # Set to live completion
      atom.config.set "autocomplete-plus.enableAutoActivation", true
      atom.config.set "editor.fontSize", "16"

      # Set the completion delay
      completionDelay = 100
      atom.config.set "autocomplete-plus.autoActivationDelay", completionDelay
      completionDelay += 100 # Rendering

      workspaceElement = atom.views.getView(atom.workspace)


  describe "when auto-activation is enabled", ->
    beforeEach ->
      runs -> atom.config.set('autocomplete-plus.enableAutoActivation', true)

      waitsForPromise -> atom.workspace.open('sample.js').then (e) ->
        editor = e

      # Activate the package
      waitsForPromise -> atom.packages.activatePackage('autocomplete-plus').then (a) ->
        mainModule = a.mainModule
        autocompleteManager = mainModule.autocompleteManagers[0]

