Attach the tree view if the project has no serialized state

This commit is contained in:
Corey Johnson 2013-02-14 16:38:23 -08:00
parent e7a8e4e3c4
commit 35ff2744ac
2 changed files with 11 additions and 0 deletions

View File

@ -2,6 +2,9 @@ module.exports =
treeView: null
activate: (@state) ->
if @state.attached == undefined and not rootView.pathToOpenIsFile
@state.attached = true
@createView() if @state.attached
rootView.command 'tree-view:toggle', => @createView().toggle()
rootView.command 'tree-view:reveal-active-file', => @createView().revealActiveFile()

View File

@ -79,6 +79,14 @@ describe "TreeView", ->
expect(treeView.hasParent()).toBeFalsy()
expect(treeView.root).toExist()
describe "when the root view is opened to a directory", ->
it "attaches to the root view", ->
rootView.deactivate()
new RootView(require.resolve('fixtures/tree-view'))
treeView = window.loadPackage("tree-view").packageMain.createView()
expect(treeView.hasParent()).toBeTruthy()
expect(treeView.root).toExist()
describe "serialization", ->
it "restores expanded directories and selected file when deserialized", ->
treeView.find('.directory:contains(dir1)').click()