mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Fix click behavior when the event target is a child of the li instead of the li
This commit is contained in:
@@ -344,8 +344,9 @@ describe "CommandPanel", ->
|
||||
it "opens a new editor with the operation's buffer and selects the search result", ->
|
||||
operation = previewList.getOperations()[4]
|
||||
|
||||
previewList.find('li:eq(4)').mousedown()
|
||||
previewList.find('li:eq(4) span').mousedown()
|
||||
|
||||
expect(previewList.getSelectedOperation()).toBe operation
|
||||
editSession = rootView.getActiveEditSession()
|
||||
expect(editSession.buffer.getPath()).toBe project.resolve(operation.getPath())
|
||||
expect(editSession.getSelectedBufferRange()).toEqual operation.getBufferRange()
|
||||
|
||||
@@ -12,11 +12,11 @@ class PreviewList extends View
|
||||
initialize: (@rootView) ->
|
||||
@on 'move-down', => @selectNextOperation()
|
||||
@on 'move-up', => @selectPreviousOperation()
|
||||
@on 'command-panel:execute', => @execute()
|
||||
@on 'command-panel:execute', => @executeSelectedOperation()
|
||||
|
||||
@on 'mousedown', 'li', (e) =>
|
||||
index = $(e.target).data('index')
|
||||
@execute(@getOperations()[index])
|
||||
@setSelectedOperationIndex(parseInt($(e.target).closest('li').data('index')))
|
||||
@executeSelectedOperation()
|
||||
|
||||
destroy: ->
|
||||
@destroyOperations() if @operations
|
||||
@@ -55,7 +55,8 @@ class PreviewList extends View
|
||||
@scrollToElement(element)
|
||||
@selectedOperationIndex = index
|
||||
|
||||
execute: (operation = @getSelectedOperation()) ->
|
||||
executeSelectedOperation: ->
|
||||
operation = @getSelectedOperation()
|
||||
editSession = @rootView.open(operation.getPath())
|
||||
operation.execute(editSession)
|
||||
false
|
||||
|
||||
Reference in New Issue
Block a user