Don't attach the TreeView when the project has no path

This commit is contained in:
Kevin Sawicki
2013-01-10 13:42:48 -08:00
parent 196a013cbc
commit 1316e2136c
2 changed files with 7 additions and 1 deletions

View File

@@ -54,7 +54,12 @@ describe "TreeView", ->
atom.loadPackage 'tree-view'
treeView = TreeView.instance
it "does not attach or create a root node", ->
it "does not attach to the root view or create a root node when initialized", ->
expect(treeView.hasParent()).toBeFalsy()
expect(treeView.root).not.toExist()
it "does not attach to the root view or create a root node when attach() is called", ->
treeView.attach()
expect(treeView.hasParent()).toBeFalsy()
expect(treeView.root).not.toExist()

View File

@@ -96,6 +96,7 @@ class TreeView extends ScrollView
@attach()
attach: ->
return unless rootView.project.getPath()
@rootView.horizontal.prepend(this)
@focus()