Return array instead of iterator for Collection.getChildCollections(true)

This commit is contained in:
Dan Stillman 2021-01-25 03:14:20 -05:00
parent 9e6a2d2e50
commit 10ca05e22e
2 changed files with 2 additions and 2 deletions

View file

@ -203,7 +203,7 @@ Zotero.Collection.prototype.getChildCollections = function (asIDs) {
// Return collectionIDs
if (asIDs) {
return this._childCollections.values();
return [...this._childCollections.values()];
}
// Return Zotero.Collection objects

View file

@ -1196,7 +1196,7 @@ describe("Zotero.Translate", function() {
assert.isNumber(translation.newCollections[0].id);
assert.lengthOf(translation.newItems, 1);
assert.isNumber(translation.newItems[0].id);
var childCollections = Array.from(collection.getChildCollections(true));
var childCollections = collection.getChildCollections(true);
assert.sameMembers(childCollections, translation.newCollections.map(c => c.id));
});
});