Don't bubble up up/down events triggered on preview list

This commit is contained in:
Kevin Sawicki 2012-12-17 14:07:52 -08:00 committed by Corey Johnson & Nathan Sobo
parent d13c2c265a
commit 6183680d15
2 changed files with 13 additions and 2 deletions

View File

@ -407,6 +407,17 @@ describe "CommandPanel", ->
_.times previewList.getOperations().length, -> previewList.trigger 'core:move-up'
it "doesn't bubble up the event and the command panel text doesn't change", ->
rootView.attachToDom()
commandPanel.miniEditor.setText "command"
previewList.focus()
previewList.trigger 'core:move-up'
expect(previewList.find('li:eq(0)')).toHaveClass 'selected'
expect(commandPanel.miniEditor.getText()).toBe 'command'
previewList.trigger 'core:move-down'
expect(previewList.find('li:eq(1)')).toHaveClass 'selected'
expect(commandPanel.miniEditor.getText()).toBe 'command'
describe "when core:confirm is triggered on the preview list", ->
it "opens the operation's buffer, selects and scrolls to the search result, and focuses the active editor", ->
rootView.height(200)

View File

@ -12,8 +12,8 @@ class PreviewList extends ScrollView
initialize: (@rootView) ->
super
@on 'core:move-down', => @selectNextOperation()
@on 'core:move-up', => @selectPreviousOperation()
@on 'core:move-down', => @selectNextOperation(); false
@on 'core:move-up', => @selectPreviousOperation(); false
@on 'core:confirm', => @executeSelectedOperation()
@on 'mousedown', 'li', (e) =>