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 <noreply@anthropic.com>
This commit is contained in:
@@ -90,4 +90,56 @@ describe('PdfViewer — loaded state', () => {
|
|||||||
})
|
})
|
||||||
).not.toThrow();
|
).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();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user