Buffer finder does not open if there are no open buffers with paths

This commit is contained in:
Nathan Sobo
2012-06-28 13:17:49 -06:00
parent 423b312e9c
commit f4832148cd
2 changed files with 8 additions and 1 deletions

View File

@@ -92,6 +92,13 @@ describe 'FuzzyFinder', ->
rootView.trigger 'fuzzy-finder:toggle-buffer-finder'
expect(rootView.find('.fuzzy-finder')).not.toExist()
describe "when there is no active editor", ->
it "does not open", ->
rootView.activeEditor().removeActiveEditSession()
expect(rootView.activeEditor()).toBeUndefined()
rootView.trigger 'fuzzy-finder:toggle-buffer-finder'
expect(rootView.find('.fuzzy-finder')).not.toExist()
describe "fuzzy-finder:cancel event", ->
it "hides the finder", ->
rootView.trigger 'fuzzy-finder:toggle-file-finder'

View File

@@ -52,7 +52,7 @@ class FuzzyFinder extends View
populateOpenBufferPaths: ->
@paths = @rootView.activeEditor()?.getOpenBufferPaths().map (path) =>
@rootView.project.relativize(path)
@populatePathList()
@populatePathList() if @paths?.length
attach: ->
@rootView.append(this)