mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-20 23:48:05 +03:00
Don't attach the tree view when a project path changes
The tree view shouldn't automatically open when the project first gets a path after not having one. It can be still be toggled to be opened once the project has a path.
This commit is contained in:
parent
63dbc2f783
commit
8bf16ba602
@ -66,23 +66,10 @@ describe "TreeView", ->
|
||||
it "serializes without throwing an exception", ->
|
||||
expect(-> treeView.serialize()).not.toThrow()
|
||||
|
||||
describe "when the project is assigned a path because a buffer is opened", ->
|
||||
it "attaches the tree and creates a root directory view", ->
|
||||
rootView.open(require.resolve('fixtures/sample.js'))
|
||||
expect(treeView.hasParent()).toBeTruthy()
|
||||
expect(treeView.root.getPath()).toBe require.resolve('fixtures')
|
||||
expect(treeView.root.parent()).toMatchSelector(".tree-view")
|
||||
|
||||
oldRoot = treeView.root
|
||||
|
||||
rootView.project.setPath('/tmp')
|
||||
expect(treeView.root).not.toEqual oldRoot
|
||||
expect(oldRoot.hasParent()).toBeFalsy()
|
||||
|
||||
describe "when the project is assigned a path because a new buffer is saved", ->
|
||||
it "attaches the tree and creates a root directory view", ->
|
||||
it "creates a root directory view but does not attach to the root view", ->
|
||||
rootView.getActiveEditSession().saveAs("/tmp/test.txt")
|
||||
expect(treeView.hasParent()).toBeTruthy()
|
||||
expect(treeView.hasParent()).toBeFalsy()
|
||||
expect(treeView.root.getPath()).toBe require.resolve('/tmp')
|
||||
expect(treeView.root.parent()).toMatchSelector(".tree-view")
|
||||
|
||||
|
@ -17,11 +17,8 @@ class TreeView extends ScrollView
|
||||
else
|
||||
@instance = new TreeView(rootView)
|
||||
|
||||
if rootView.project.getPath()
|
||||
@instance.attach() unless rootView.pathToOpenIsFile
|
||||
else
|
||||
rootView.project.one "path-changed", =>
|
||||
@instance.attach()
|
||||
if rootView.project.getPath() and not rootView.pathToOpenIsFile
|
||||
@instance.attach()
|
||||
|
||||
@deactivate: ->
|
||||
@instance.deactivate()
|
||||
|
Loading…
Reference in New Issue
Block a user