VimMode = require '../lib/vim-mode'
StatusBarManager = require '../lib/status-bar-manager'
+[globalVimState, statusBarManager] = []
+
beforeEach ->
atom.workspace ||= {}
+ statusBarManager = null
+ globalVimState = null
+ spyOn(atom, 'beep')
getEditorElement = (callback) ->
textEditor = null
element = document.createElement("atom-text-editor")
element.setModel(textEditor)
element.classList.add('vim-mode')
- element.vimState = new VimState(element, new StatusBarManager, new GlobalVimState)
+ statusBarManager ?= new StatusBarManager
+ globalVimState ?= new GlobalVimState
+ element.vimState = new VimState(element, statusBarManager, globalVimState)
element.addEventListener "keydown", (e) ->
atom.keymaps.handleKeyboardEvent(e)
+ # mock parent element for the text editor
+ document.createElement('html').appendChild(atom.views.getView(textEditor))
+
callback(element)
mockPlatform = (editorElement, platform) ->