FileFinder tests pass

This commit is contained in:
Corey Johnson & Nathan Sobo
2011-12-29 15:12:30 -08:00
parent 197fd6b82a
commit 5aee51eb35
5 changed files with 4 additions and 4 deletions

View File

@@ -14,7 +14,7 @@ describe "RootView", ->
describe "toggleFileFinder", ->
describe "when the editor has a url", ->
beforeEach ->
rootView.editor.open require.resolve('window.coffee')
rootView.editor.open require.resolve('fixtures/file-finder-dir/a')
it "shows the FileFinder when it is not on screen and hides it when it is", ->
expect(rootView.find('.file-finder')).not.toExist()
@@ -23,9 +23,9 @@ describe "RootView", ->
rootView.toggleFileFinder()
expect(rootView.find('.file-finder')).not.toExist()
it "shows urls for all files in the same directory as editor.url", ->
it "shows urls for all files (not directories) in the same directory as editor.url", ->
rootView.toggleFileFinder()
expect(rootView.fileFinder.urlList.children('li').length).toBeGreaterThan 1
expect(rootView.fileFinder.urlList.children('li').length).toBe 2
describe "when the editor has no url", ->
it "does not open the FileFinder", ->

0
spec/fixtures/file-finder-dir/a vendored Normal file
View File

View File

0
spec/fixtures/file-finder-dir/b vendored Normal file
View File

View File

@@ -33,7 +33,7 @@ class RootView extends Template
@fileFinder = null
else
directory = fs.directory @editor.buffer.url
urls = fs.list directory
urls = (url for url in fs.list directory when fs.isFile url)
@fileFinder = FileFinder.build({urls})
@addPane(@fileFinder)
@fileFinder.input.focus()