mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Include window events in event-palette
Previously these weren't displayed since event the documentation loop stopped at the document element and window events weren't included even though they are applicable for the currently focused element.
This commit is contained in:
@@ -30,6 +30,20 @@ describe "EventPalette", ->
|
||||
else
|
||||
expect(eventLi).not.toExist()
|
||||
|
||||
it "displays all events registerd on the window", ->
|
||||
editorEvents = rootView.getActiveEditor().events()
|
||||
windowEvents = $(window).events()
|
||||
expect(_.isEmpty(windowEvents)).toBeFalsy()
|
||||
for eventName, description of windowEvents
|
||||
eventLi = palette.list.children("[data-event-name='#{eventName}']")
|
||||
description = editorEvents[eventName] unless description
|
||||
if description
|
||||
expect(eventLi).toExist()
|
||||
expect(eventLi.find('.event-name')).toHaveText(eventName)
|
||||
expect(eventLi.find('.event-description')).toHaveText(description)
|
||||
else
|
||||
expect(eventLi).not.toExist()
|
||||
|
||||
it "focuses the mini-editor and selects the first event", ->
|
||||
expect(palette.miniEditor.isFocused).toBeTruthy()
|
||||
expect(palette.find('.event:first')).toHaveClass 'selected'
|
||||
|
||||
@@ -28,7 +28,7 @@ class EventPalette extends SelectList
|
||||
@keyBindings = _.losslessInvert(keymap.bindingsForElement(@previouslyFocusedElement))
|
||||
|
||||
events = []
|
||||
for eventName, eventDescription of @previouslyFocusedElement.events()
|
||||
for eventName, eventDescription of _.extend($(window).events(), @previouslyFocusedElement.events())
|
||||
events.push({eventName, eventDescription}) if eventDescription
|
||||
|
||||
events = _.sortBy events, (e) -> e.eventDescription
|
||||
|
||||
Reference in New Issue
Block a user