Clear the miniEditor when showing the event palette

This commit is contained in:
Nathan Sobo
2012-10-04 10:07:54 -10:00
parent c57e448ddd
commit 6bfffcac55
2 changed files with 7 additions and 0 deletions

View File

@@ -24,6 +24,12 @@ describe "EventPalette", ->
expect(palette.miniEditor.isFocused).toBeTruthy()
expect(palette.find('.event:first')).toHaveClass 'selected'
it "clears the previous mini editor text", ->
palette.miniEditor.setText('hello')
palette.trigger 'event-palette:toggle'
rootView.trigger 'event-palette:toggle'
expect(palette.miniEditor.getText()).toBe ''
describe "when event-palette:toggle is triggered on the open event palette", ->
it "focus the root view and detaches the event palette", ->
expect(palette.hasParent()).toBeTruthy()

View File

@@ -23,6 +23,7 @@ class EventPalette extends SelectList
@previouslyFocusedElement = $(':focus')
@setArray(@previouslyFocusedElement.events())
@appendTo(@rootView)
@miniEditor.setText('')
@miniEditor.focus()
itemForElement: ([eventName, description]) ->