TreeView starts with root being selected

This commit is contained in:
Corey Johnson & Nathan Sobo
2012-05-11 14:31:48 -07:00
parent 9990fd7b98
commit 2f86a3a6e5
2 changed files with 5 additions and 0 deletions

View File

@@ -43,6 +43,9 @@ describe "TreeView", ->
expect(rootEntries.find('> .file:contains(sample.js)')).toExist()
expect(rootEntries.find('> .file:contains(sample.txt)')).toExist()
it "selects the rootview", ->
expect(treeView.selectedEntry()).toEqual treeView.root
describe "when the project has no path", ->
beforeEach ->
treeView.deactivate()

View File

@@ -56,6 +56,8 @@ class TreeView extends View
@on 'tree-view:unfocus', => @rootView.activeEditor()?.focus()
@rootView.on 'tree-view:focus', => this.focus()
@selectEntry(@root)
afterAttach: (onDom) ->
@focus() if @focusAfterAttach