Mailspring/spec-nylas/test_utils.coffee
Ben Gotow 91edef9f7a fix(naming): Move atom/inbox/nilas refs to Nylas
Conflicts:
	internal_packages/inbox-activity-bar/lib/activity-bar-long-poll-item.cjsx
2015-05-15 11:07:28 -07:00

19 lines
522 B
CoffeeScript

# Utils for testing.
CSON = require 'season'
KeymapManager = require 'atom-keymap'
InboxTestUtils =
loadKeymap: (keymapPath) ->
baseKeymaps = CSON.readFileSync("keymaps/base.cson")
atom.keymaps.add("keymaps/base.cson", baseKeymaps)
if keymapPath?
keymapFile = CSON.readFileSync(keymapPath)
atom.keymaps.add(keymapPath, keymapFile)
keyPress: (key, target) ->
event = KeymapManager.buildKeydownEvent(key, target: target)
document.dispatchEvent(event)
module.exports = InboxTestUtils