From 42968949b658d5c94cf0ab31ff3327ac10d16d22 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 21 Mar 2016 18:11:30 -0400 Subject: [PATCH] Fix collection export Closes #734, maybe? --- .../zotero/xpcom/translation/translate_item.js | 2 +- test/tests/translateTest.js | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) 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