Fix error generating context menu for multiple standalone attachments

Regression from f161d167ae
This commit is contained in:
Dan Stillman 2021-12-26 23:15:47 -05:00
parent 14caa3a895
commit 24104dc685
2 changed files with 11 additions and 0 deletions

View file

@ -3075,6 +3075,7 @@ var ZoteroPane = new function()
function attachmentsWithExtractableAnnotations(item) {
if (!item.isRegularItem()) return [];
return Zotero.Items.get(item.getAttachments())
.filter(item => isAttachmentWithExtractableAnnotations(item));
}

View file

@ -801,4 +801,14 @@ describe("ZoteroPane", function() {
assert.lengthOf(Object.keys(conditions), 3);
});
});
describe("#buildItemContextMenu()", function () {
it("should build menu for multiple standalone file attachments", async function () {
var item1 = await importFileAttachment('test.png');
var item2 = await importFileAttachment('test.png');
await zp.selectItems([item1.id, item2.id]);
await zp.buildItemContextMenu();
});
});
})