From 0e8b195c5ad584d5085ef8dfa0802d06de019067 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 24 Mar 2026 12:08:14 -0400 Subject: [PATCH] Add tests for image annotation placeholder in notes --- test/tests/annotationsTest.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/tests/annotationsTest.js b/test/tests/annotationsTest.js index 96f0151e05..2ad3f62aa9 100644 --- a/test/tests/annotationsTest.js +++ b/test/tests/annotationsTest.js @@ -556,4 +556,25 @@ describe("Create a note from annotations from multiple items and attachments", f assert.ok(doc.querySelector('span.underline')); assert.ok(doc.querySelector('span.highlight')); }); + + it("should show placeholder for image annotation with comment but without cache image", async function () { + let attachment = await importPDFAttachment(); + let annotation = await createAnnotation('image', attachment); + let cachePath = Zotero.Annotations.getCacheImagePath(annotation); + await OS.File.remove(cachePath, { ignoreAbsent: true }); + let note = await Zotero.EditorInstance.createNoteFromAnnotations([annotation]); + let placeholder = Zotero.getString('annotation-image-not-available'); + assert.include(note.note, placeholder); + assert.include(note.note, annotation.annotationComment); + }); + + it("should show placeholder for image annotation without comment or cache image", async function () { + let attachment = await importPDFAttachment(); + let annotation = await createAnnotation('image', attachment, { comment: '' }); + let cachePath = Zotero.Annotations.getCacheImagePath(annotation); + await OS.File.remove(cachePath, { ignoreAbsent: true }); + let note = await Zotero.EditorInstance.createNoteFromAnnotations([annotation]); + let placeholder = Zotero.getString('annotation-image-not-available'); + assert.include(note.note, placeholder); + }); });