Add spec for busting the cache on window focus

This commit is contained in:
Kevin Sawicki
2012-12-18 08:49:58 -08:00
parent dd8aff6e69
commit 9823f5ba85

View File

@@ -228,3 +228,23 @@ describe 'FuzzyFinder', ->
runs ->
expect(rootView.project.getFilePaths).toHaveBeenCalled()
it "busts the cache when the window gains focus", ->
spyOn(rootView.project, "getFilePaths").andCallThrough()
rootView.trigger 'fuzzy-finder:toggle-file-finder'
waitsFor ->
finder.list.children('li').length > 0
runs ->
expect(rootView.project.getFilePaths).toHaveBeenCalled()
rootView.project.getFilePaths.reset()
$(window).trigger 'focus'
rootView.trigger 'fuzzy-finder:toggle-file-finder'
rootView.trigger 'fuzzy-finder:toggle-file-finder'
waitsFor ->
finder.list.children('li').length > 0
runs ->
expect(rootView.project.getFilePaths).toHaveBeenCalled()