From f425b8d8d9fe5d7394f076899e1b362b5c957b10 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 18 Dec 2020 09:00:18 -0500 Subject: [PATCH] Fix image annotation test after Item.annotationImageURL removal --- test/tests/itemTest.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/test/tests/itemTest.js b/test/tests/itemTest.js index 50bae3a3c5..a802bc7d4a 100644 --- a/test/tests/itemTest.js +++ b/test/tests/itemTest.js @@ -1266,8 +1266,9 @@ describe("Zotero.Item", function () { }); await annotation.saveTx(); + var blob = new Blob([array], { type: 'image/png' }); await Zotero.Attachments.importEmbeddedImage({ - blob: new Blob([array], { type: 'image/png' }), + blob, parentItemID: annotation.id }); @@ -1283,9 +1284,17 @@ describe("Zotero.Item", function () { ); assert.equal(imageAttachment.attachmentContentType, 'image/png'); + var blob2 = await new Zotero.Promise((resolve) => { + var reader = new FileReader(); + reader.addEventListener("load", function () { + resolve(reader.result); + }, false); + reader.readAsDataURL(blob); + }); + assert.equal( - annotation.annotationImageURL, - `zotero://attachment/library/items/${imageAttachment.key}` + await imageAttachment.attachmentDataURI, + blob2 ); }); });