mirror of
https://github.com/atom/atom.git
synced 2026-01-25 23:08:18 -05:00
Collapse selected path with left arrow
This commit is contained in:
@@ -16,3 +16,6 @@
|
||||
'.command-panel':
|
||||
'ctrl-{': 'command-panel:collapse-all'
|
||||
'ctrl-}': 'command-panel:expand-all'
|
||||
|
||||
'.command-panel .preview-list':
|
||||
'left': 'command-panel:collapse-result'
|
||||
|
||||
@@ -25,6 +25,13 @@ class PreviewList extends ScrollView
|
||||
@on 'mousedown', 'li.path', @onPathSelected
|
||||
@command 'command-panel:collapse-all', => @collapseAllPaths()
|
||||
@command 'command-panel:expand-all', => @expandAllPaths()
|
||||
@command 'command-panel:collapse-result', @collapseSelectedPath
|
||||
|
||||
collapseSelectedPath: (event) =>
|
||||
e = $('.selected').closest('.path')
|
||||
return if e.hasClass 'is-collapsed'
|
||||
e.children('ul.matches').hide 100, (e) ->
|
||||
$(this).closest('li.path').add 'is-collapsed'
|
||||
|
||||
onPathSelected: (event) =>
|
||||
e = $(event.target)
|
||||
|
||||
@@ -478,3 +478,10 @@ 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", ->
|
||||
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()
|
||||
|
||||
Reference in New Issue
Block a user