From c34295542d74225003c3b3110a2ca4078edaae20 Mon Sep 17 00:00:00 2001 From: Marcel Date: Sun, 10 May 2026 06:28:02 +0200 Subject: [PATCH] test(viewer): add more PdfViewer prop combinations flashAnnotationId, blockNumbers, activeAnnotationId, combined with transcribeMode, onAnnotationClick wired in. 5 new tests covering ~10 prop-combo branches. Refs #496. Co-Authored-By: Claude Sonnet 4.6 --- .../document/viewer/PdfViewer.svelte.test.ts | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/frontend/src/lib/document/viewer/PdfViewer.svelte.test.ts b/frontend/src/lib/document/viewer/PdfViewer.svelte.test.ts index a109303f..3918c6db 100644 --- a/frontend/src/lib/document/viewer/PdfViewer.svelte.test.ts +++ b/frontend/src/lib/document/viewer/PdfViewer.svelte.test.ts @@ -90,4 +90,56 @@ describe('PdfViewer — loaded state', () => { }) ).not.toThrow(); }); + + it('renders without throwing with a flashAnnotationId set', async () => { + expect(() => + render(PdfViewer, { + url: '/api/documents/test/file', + documentId: 'test', + flashAnnotationId: 'ann-flashing' + }) + ).not.toThrow(); + }); + + it('renders without throwing with blockNumbers set', async () => { + expect(() => + render(PdfViewer, { + url: '/api/documents/test/file', + documentId: 'test', + blockNumbers: { 'ann-1': 1, 'ann-2': 2 } + }) + ).not.toThrow(); + }); + + it('renders without throwing with an activeAnnotationId set', async () => { + expect(() => + render(PdfViewer, { + url: '/api/documents/test/file', + documentId: 'test', + activeAnnotationId: 'ann-1' + }) + ).not.toThrow(); + }); + + it('renders without throwing in transcribeMode + canvas + activeAnnotationId combo', async () => { + expect(() => + render(PdfViewer, { + url: '/api/documents/test/file', + documentId: 'test', + transcribeMode: true, + activeAnnotationId: 'ann-1' + }) + ).not.toThrow(); + }); + + it('survives onAnnotationClick callback being invoked indirectly', async () => { + const onAnnotationClick = vi.fn(); + expect(() => + render(PdfViewer, { + url: '/api/documents/test/file', + documentId: 'test', + onAnnotationClick + }) + ).not.toThrow(); + }); });