core:close events close Command Panel (but not the entire window)

This commit is contained in:
Corey Johnson
2012-10-25 14:03:04 -07:00
parent 0501eee7ab
commit b4431da6ab
2 changed files with 9 additions and 2 deletions

View File

@@ -79,9 +79,16 @@ describe "CommandPanel", ->
rootView2.deactivate()
describe "when core:close is triggered on the command panel", ->
it "detaches the command panel", ->
it "detaches the command panel, focuses the RootView and does not bubble the core:close event", ->
commandPanel.attach()
rootViewCloseHandler = jasmine.createSpy('rootViewCloseHandler')
rootView.on 'core:close', rootViewCloseHandler
spyOn(rootView, 'focus')
commandPanel.trigger('core:close')
expect(rootView.focus).toHaveBeenCalled()
expect(rootViewCloseHandler).not.toHaveBeenCalled()
expect(commandPanel.hasParent()).toBeFalsy()
describe "when command-panel:toggle is triggered on the root view", ->

View File

@@ -51,7 +51,7 @@ class CommandPanel extends View
@historyIndex = @history.length
@command 'tool-pane:unfocus', => @rootView.focus()
@command 'core:close', => @detach()
@command 'core:close', => @detach(); false
@command 'core:confirm', => @execute()
@rootView.command 'command-panel:toggle', => @toggle()