Expand result with right arrow key

This commit is contained in:
Kevin Sawicki
2013-02-13 21:49:48 -08:00
parent 4088d33dc9
commit 20d7956cc1
3 changed files with 11 additions and 3 deletions

View File

@@ -19,3 +19,4 @@
'.command-panel .preview-list':
'left': 'command-panel:collapse-result'
'right': 'command-panel:expand-result'

View File

@@ -18,7 +18,12 @@ class PathView extends View
initialize: ({previewList}) ->
@on 'mousedown', @onPathSelected
previewList.command 'command-panel:collapse-result', =>
@collapse(true) if @find('.selected').length
@collapse(true) if @isSelected()
previewList.command 'command-panel:expand-result', =>
@expand(true) if @isSelected()
isSelected: ->
@hasClass('selected') or @find('.selected').length
onPathSelected: (event) =>
e = $(event.target)

View File

@@ -479,9 +479,11 @@ describe "CommandPanel", ->
previewList.find('li.path:first-child').mousedown()
expect(previewList.find('li.path:first-child ul.matches')).toBeVisible()
describe "when command-panel:collapse-result is triggered", ->
it "collapses the path of the selected operation", ->
describe "when command-panel:collapse-result and command-panel:expand-result are triggered", ->
it "collapses and expands the path of the selection", ->
rootView.attachToDom()
expect(previewList.find('li.path:first-child ul.matches')).toBeVisible()
previewList.trigger 'command-panel:collapse-result'
expect(previewList.find('li.path:first-child ul.matches')).toBeHidden()
previewList.trigger 'command-panel:expand-result'
expect(previewList.find('li.path:first-child ul.matches')).toBeVisible()