Don't select operations if path is collapsed

This commit is contained in:
Kevin Sawicki
2013-02-13 22:06:00 -08:00
parent 1cc6429dc7
commit b626ce91a9
2 changed files with 15 additions and 2 deletions

View File

@@ -58,7 +58,10 @@ class PreviewList extends ScrollView
selectedView = @find('.selected').view()
if selectedView instanceof PathView
nextView = selectedView.find('.operation:first')
if selectedView.hasClass('is-collapsed')
nextView = selectedView.next().view()
else
nextView = selectedView.find('.operation:first')
else
nextView = selectedView.next().view() ? selectedView.closest('.path').next().view()
if nextView?
@@ -70,7 +73,8 @@ class PreviewList extends ScrollView
selectedView = @find('.selected').view()
if selectedView instanceof PathView
previousView = selectedView.prev().find('.operation:last').view()
previousView = selectedView.prev()
previousView = previousView.find('.operation:last').view() unless previousView.hasClass('is-collapsed')
else
previousView = selectedView.prev().view() ? selectedView.closest('.path').view()

View File

@@ -416,6 +416,15 @@ describe "CommandPanel", ->
expect(previewList.find('li.operation:eq(0)')).toHaveClass 'selected'
expect(commandPanel.miniEditor.getText()).toBe 'command'
it "doesn't select collapsed operations", ->
rootView.attachToDom()
previewList.trigger 'command-panel:collapse-result'
expect(previewList.find('li.path:eq(0)')).toHaveClass 'selected'
previewList.trigger 'core:move-down'
expect(previewList.find('li.path:eq(1)')).toHaveClass 'selected'
previewList.trigger 'core:move-up'
expect(previewList.find('li.path:eq(0)')).toHaveClass 'selected'
describe "when move-to-top and move-to-bottom are triggered on the preview list", ->
it "selects the first path or last operation", ->
rootView.attachToDom()