Clear file finder's mini-editor between togglings

This commit is contained in:
Nathan Sobo 2012-05-07 19:33:17 -06:00
parent 31163f1d8c
commit b554318048
2 changed files with 6 additions and 1 deletions

View File

@ -23,12 +23,16 @@ describe 'FileFinder', ->
rootView.trigger 'file-finder:toggle'
expect(rootView.find('.file-finder')).toExist()
expect(rootView.find('.file-finder input:focus')).toExist()
finder.editor.insertText('this should not show up next time we toggle')
rootView.trigger 'file-finder:toggle'
expect(editor1.isFocused).toBeFalsy()
expect(editor2.isFocused).toBeTruthy()
expect(rootView.find('.file-finder')).not.toExist()
rootView.trigger 'file-finder:toggle'
expect(finder.editor.getText()).toBe ''
it "shows all relative file paths for the current project and selects the first", ->
rootView.trigger 'file-finder:toggle'
rootView.project.getFilePaths().done (paths) ->

View File

@ -27,7 +27,7 @@ class FileFinder extends View
@on 'file-finder:select-file', => @select()
@editor.addClass 'single-line'
@editor.buffer.on 'change', => @populatePathList()
@editor.buffer.on 'change', => @populatePathList() if @hasParent()
@editor.off 'move-up move-down'
toggle: ->
@ -44,6 +44,7 @@ class FileFinder extends View
detach: ->
@rootView.focus()
super
@editor.setText('')
populatePathList: ->
@pathList.empty()