a TreeView without a root path can be serialized

This commit is contained in:
Corey Johnson
2012-07-25 15:07:13 -07:00
parent fefb3bc175
commit 70dfdc6cdd
2 changed files with 4 additions and 1 deletions

View File

@@ -58,6 +58,9 @@ describe "TreeView", ->
it "does not create a root node", ->
expect(treeView.root).not.toExist()
it "serializes without throwing an exception", ->
expect(-> treeView.serialize()).not.toThrow()
it "creates a root view when the project path is created", ->
rootView.open(require.resolve('fixtures/sample.js'))
expect(treeView.root.getPath()).toBe require.resolve('fixtures')

View File

@@ -60,7 +60,7 @@ class TreeView extends View
@focus() if @focusAfterAttach
serialize: ->
directoryExpansionStates: @root.serializeEntryExpansionStates()
directoryExpansionStates: @root?.serializeEntryExpansionStates()
selectedPath: @selectedEntry()?.getPath()
hasFocus: @is(':focus')
attached: @hasParent()