diff --git a/src/annotator/anchoring/pdf.ts b/src/annotator/anchoring/pdf.ts index 1fdd70971dd..6696db7d30d 100644 --- a/src/annotator/anchoring/pdf.ts +++ b/src/annotator/anchoring/pdf.ts @@ -261,7 +261,7 @@ const isNotSpace = (char: string) => !isSpace(char); /** * Determines if provided text layer is done rendering. - * It works on older PDF.js versions which expose a public renderingDone prop, + * It works on older PDF.js versions which expose a public `renderingDone` prop, * and newer versions as well */ export function isTextLayerRenderingDone(textLayer: TextLayer): boolean { diff --git a/src/annotator/anchoring/test/pdf-test.js b/src/annotator/anchoring/test/pdf-test.js index 7199d6645e1..065e33bb12e 100644 --- a/src/annotator/anchoring/test/pdf-test.js +++ b/src/annotator/anchoring/test/pdf-test.js @@ -741,18 +741,22 @@ describe('annotator/anchoring/pdf', () => { }); [ - { element: null, expectedResult: false }, - { element: {}, expectedResult: true }, - ].forEach(({ element, expectedResult }) => { + { div: document.createElement('div'), expectedResult: false }, + { + div: (function () { + const div = document.createElement('div'); + + const endOfContent = document.createElement('div'); + endOfContent.className = 'endOfContent'; + div.append(endOfContent); + + return div; + })(), + expectedResult: true, + }, + ].forEach(({ div, expectedResult }) => { it('returns true if the div contains an endOfContent element', () => { - assert.equal( - isTextLayerRenderingDone({ - div: { - querySelector: () => element, - }, - }), - expectedResult, - ); + assert.equal(isTextLayerRenderingDone({ div }), expectedResult); }); }); }); diff --git a/src/types/pdfjs.ts b/src/types/pdfjs.ts index 7d63e026bfb..c7373e039fa 100644 --- a/src/types/pdfjs.ts +++ b/src/types/pdfjs.ts @@ -171,6 +171,7 @@ export type PDFViewerApplication = { * Indicates the download of the PDF has completed. * This prop is not set in PDF.js >=4.5, in which case you should use * `PDFViewerApplication.pdfDocument.getDownloadInfo()` instead. + * See https://github.com/mozilla/pdf.js/pull/18463/commits/64a4f0dc7e60e86a7c1da1dc903497fff71abe2c * * @see {PDFDocument} */