mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-22 00:19:24 +03:00
Attach the tree view if the project has no serialized state
This commit is contained in:
parent
e7a8e4e3c4
commit
35ff2744ac
@ -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()
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user