Bug 1060041 - Don't expand folders in projecteditor tree by default;r=jryans

This commit is contained in:
Brian Grinstead 2014-08-29 15:49:11 -07:00
Родитель d6888a866b
Коммит de2965fbbf
3 изменённых файлов: 16 добавлений и 0 удалений

Просмотреть файл

@ -57,6 +57,13 @@ var Resource = Class({
*/
get hasChildren() { return this.children && this.children.size > 0; },
/**
* Is this Resource the root (top level for the store)?
*/
get isRoot() {
return !this.parent
},
/**
* Sorted array of children for display
*/

Просмотреть файл

@ -84,6 +84,9 @@ var ResourceContainer = Class({
evt.stopPropagation();
}, true);
if (!this.resource.isRoot) {
this.expanded = false;
}
this.update();
},

Просмотреть файл

@ -35,8 +35,14 @@ let test = asyncTest(function*() {
function selectFileFirstLoad(projecteditor, resource) {
ok (resource && resource.path, "A valid resource has been passed in for selection " + (resource && resource.path));
projecteditor.projectTree.selectResource(resource);
let container = projecteditor.projectTree.getViewContainer(resource);
if (resource.isRoot) {
ok (container.expanded, "The root directory is expanded by default.");
return;
}
if (resource.isDir) {
ok (!container.expanded, "A directory is not expanded by default.");
return;
}