 
     # keys must be String or Array
     # Not support Object for keys to avoid ambiguity.
-    element ?= @editorElement
+    target = @editorElement
     mocked = null
     keys = [keys] unless _.isArray(keys)
 
     for k in keys
       if _.isString(k)
-        _keystroke(k, {element})
+        _keystroke(k, {target})
+        continue
       else
         switch
           when k.platform?
-            mockPlatform(element, k.platform)
+            mockPlatform(target, k.platform)
             mocked = true
           when k.char?
             chars =

    when 2 then [file, callback] = args

  waitsForPromise ->
    atom.packages.activatePackage(packageName)

  waitsForPromise ->
    file = atom.project.resolvePath(file) if file
    atom.workspace.open(file).then (e) ->
      editor = e

  runs ->
    pack = atom.packages.getActivePackage(packageName)
    main = pack.mainModule
    vimState = main.getEditorState(editor)
    {editorElement} = vimState
    editorElement.addEventListener 'keydown', (e) ->
      atom.keymaps.handleKeyboardEvent(e)

    callback(vimState, new VimEditor(vimState))

class TextData

      expect(@editorElement.classList.contains(m)).toBe(false)

  # Public
  # options
  # - waitsForFinish
  keystroke: (keys, options={}) =>
    # {element} = options
    # console.log element
    if options.waitsForFinish
      finished = false
      @vimState.onDidFinishOperation -> finished = true
