FileFinder removes itself when item is selected.

This commit is contained in:
Corey Johnson
2012-01-04 15:47:41 -08:00
parent 3ffe57f228
commit 7e270d641d
3 changed files with 4 additions and 1 deletions

View File

@@ -65,9 +65,11 @@ describe 'FileFinder', ->
finder = FileFinder.build {urls, selected: selectedCallback}
it "when a file is selected Editor.open is called", ->
spyOn(finder, 'remove')
finder.moveDown()
finder.select()
expect(selectedCallback).toHaveBeenCalledWith(urls[1])
expect(finder.remove).toHaveBeenCalled()
it "when no file is selected, does nothing", ->
spyOn(atom, 'open')

View File

@@ -35,6 +35,7 @@ class FileFinder extends Template
select: ->
filePath = @findSelectedLi().text()
@selected(filePath) if filePath and @selected
@remove()
moveUp: ->
@findSelectedLi()

View File

@@ -38,7 +38,7 @@ class RootView extends Template
toggleFileFinder: ->
return unless @project
if @fileFinder
if @fileFinder and @fileFinder.parent()[0]
@fileFinder.remove()
@fileFinder = null
else