www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 2d396141439c6bdef3961179ebe09b7342a0f46a
parent ab10d1617eaba3ccd764cda5e5802b70c3d53bb9
Author: Dan Stillman <dstillman@zotero.org>
Date:   Mon, 18 Jul 2016 17:15:48 -0400

Fix subcollections being shown at top level of groups

Fixes #1065

Diffstat:
Mchrome/content/zotero/xpcom/collectionTreeView.js | 2+-
Mtest/tests/collectionTreeViewTest.js | 20++++++++++++++++++++
2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/chrome/content/zotero/xpcom/collectionTreeView.js b/chrome/content/zotero/xpcom/collectionTreeView.js @@ -1220,7 +1220,7 @@ Zotero.CollectionTreeView.prototype._expandRow = Zotero.Promise.coroutine(functi } if (isLibrary) { - var collections = Zotero.Collections.getByLibrary(libraryID, treeRow.ref.id); + var collections = Zotero.Collections.getByLibrary(libraryID); } else if (isCollection) { var collections = Zotero.Collections.getByParent(treeRow.ref.id); diff --git a/test/tests/collectionTreeViewTest.js b/test/tests/collectionTreeViewTest.js @@ -139,6 +139,26 @@ describe("Zotero.CollectionTreeView", function() { assert.ok(cv.getRowIndexByID(col2.treeViewID)) assert.ok(cv.getRowIndexByID(col3.treeViewID)) }); + + it("should open a group and show top-level collections", function* () { + var group = yield createGroup(); + var libraryID = group.libraryID; + var col1 = yield createDataObject('collection', { libraryID }); + var col2 = yield createDataObject('collection', { libraryID }); + var col3 = yield createDataObject('collection', { libraryID }); + var col4 = yield createDataObject('collection', { libraryID, parentID: col1.id }); + var col5 = yield createDataObject('collection', { libraryID, parentID: col4.id }); + + // Close everything + [col4, col1, group].forEach(o => cv._closeContainer(cv.getRowIndexByID(o.treeViewID))); + + yield cv.expandLibrary(libraryID); + assert.isNumber(cv.getRowIndexByID(col1.treeViewID)); + assert.isNumber(cv.getRowIndexByID(col2.treeViewID)); + assert.isNumber(cv.getRowIndexByID(col3.treeViewID)); + assert.isFalse(cv.getRowIndexByID(col4.treeViewID)); + assert.isFalse(cv.getRowIndexByID(col5.treeViewID)); + }); }); describe("#expandToCollection()", function () {