Fix bug: file finder correctly focuses editor after opening a file.

This commit is contained in:
Corey Johnson & Nathan Sobo 2012-05-14 16:35:03 -06:00
parent 9079bcb103
commit abc230eee3
2 changed files with 8 additions and 5 deletions

View File

@ -133,13 +133,14 @@ describe 'FileFinder', ->
[editor1, editor2] = []
beforeEach ->
rootView.find('.editor').trigger 'split-right'
[editor1, editor2] = rootView.find('.editor').map -> $(this).view()
rootView.attachToDom()
editor1 = rootView.activeEditor()
editor2 = editor1.splitRight()
expect(rootView.activeEditor()).toBe editor2
rootView.trigger 'file-finder:toggle'
describe "when there is a path selected", ->
it "opens the file associated with that path in the editor", ->
fit "opens the file associated with that path in the editor", ->
finder.trigger 'move-down'
selectedLi = finder.find('li:eq(1)')

View File

@ -27,7 +27,6 @@ class FileFinder extends View
@on 'move-down', => @moveDown()
@on 'file-finder:select-file', => @select()
@miniEditor.on 'focusout', => @detach()
@miniEditor.buffer.on 'change', => @populatePathList() if @hasParent()
@miniEditor.off 'move-up move-down'
@ -41,8 +40,11 @@ class FileFinder extends View
@rootView.project.getFilePaths().done (@paths) => @populatePathList()
@rootView.append(this)
@miniEditor.focus()
@miniEditor.on 'focusout', => @detach()
detach: ->
console.log "in detach, focusing root view"
@miniEditor.off 'focusout'
@rootView.focus()
super
@miniEditor.setText('')