mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Move GlobalKeymap instance to App. Clear bindings between examples.
This commit is contained in:
@@ -10,6 +10,7 @@ describe "RootView", ->
|
||||
beforeEach ->
|
||||
url = require.resolve 'fixtures/dir/a'
|
||||
rootView = RootView.build {url}
|
||||
rootView.enableKeymap()
|
||||
project = rootView.project
|
||||
|
||||
describe "initialize", ->
|
||||
@@ -86,7 +87,7 @@ describe "RootView", ->
|
||||
beforeEach ->
|
||||
commandHandler = jasmine.createSpy('commandHandler')
|
||||
rootView.on('foo-command', commandHandler)
|
||||
rootView.globalKeymap.bindKeys('*', 'x': 'foo-command')
|
||||
atom.globalKeymap.bindKeys('*', 'x': 'foo-command')
|
||||
|
||||
describe "when a key is typed in the editor that has a binding in the keymap", ->
|
||||
it "triggers the key binding's command as an event and stops its propagation", ->
|
||||
@@ -99,6 +100,7 @@ describe "RootView", ->
|
||||
describe "when a keydown event is triggered on the RootView (not originating from Ace)", ->
|
||||
it "triggers matching keybindings for that event", ->
|
||||
event = keydownEvent 'x', target: rootView[0]
|
||||
|
||||
rootView.trigger(event)
|
||||
expect(commandHandler).toHaveBeenCalled()
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ BindingSet = require 'binding-set'
|
||||
|
||||
afterEach ->
|
||||
(new Native).resetMainMenu()
|
||||
atom.globalKeymap.reset()
|
||||
|
||||
window.atom = new (require 'app')
|
||||
|
||||
@@ -25,3 +26,7 @@ $.fn.resultOfTrigger = (type) ->
|
||||
event = $.Event(type)
|
||||
this.trigger(event)
|
||||
event.result
|
||||
|
||||
$.fn.enableKeymap = ->
|
||||
@on 'keydown', (e) => atom.globalKeymap.handleKeyEvent(e)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user