diff --git a/chrome/content/zotero/xpcom/translation/translate_item.js b/chrome/content/zotero/xpcom/translation/translate_item.js index 6e039327a8..c8fe1f17e0 100644 --- a/chrome/content/zotero/xpcom/translation/translate_item.js +++ b/chrome/content/zotero/xpcom/translation/translate_item.js @@ -672,7 +672,7 @@ Zotero.Translate.ItemGetter.prototype = { } } - this._itemsLeft = Array.from(items.values); + this._itemsLeft = Array.from(items.values()); this.numItems = this._itemsLeft.length; }), diff --git a/test/tests/translateTest.js b/test/tests/translateTest.js index b580b7660f..91df98c2fc 100644 --- a/test/tests/translateTest.js +++ b/test/tests/translateTest.js @@ -1156,5 +1156,19 @@ describe("Zotero.Translate.ItemGetter", function() { } })); }); + + describe("#setCollection()", function () { + it("should add collection items", function* () { + var col = yield createDataObject('collection'); + var item1 = yield createDataObject('item', { collections: [col.id] }); + var item2 = yield createDataObject('item', { collections: [col.id] }); + var item3 = yield createDataObject('item'); + + let getter = new Zotero.Translate.ItemGetter(); + getter.setCollection(col); + + assert.equal(getter.numItems, 2); + }); + }); }); } \ No newline at end of file