1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Improve the loadingParams functionality in the API

- Move the definition of the `loadingParams` Object, to simplify the code.

 - Add a unit-test, since none existed and the viewer depends on this functionality.
This commit is contained in:
Jonas Jenwald 2024-05-24 09:18:19 +02:00
parent 08bf96865d
commit 06334c97ef
2 changed files with 22 additions and 10 deletions

View file

@ -1069,6 +1069,23 @@ describe("api", function () {
await loadingTask.destroy();
});
it("gets loadingParams", async function () {
const loadingTask = getDocument(
buildGetDocumentParams(basicApiFileName, {
disableAutoFetch: true,
enableXfa: true,
})
);
const pdfDoc = await loadingTask.promise;
expect(pdfDoc.loadingParams).toEqual({
disableAutoFetch: true,
enableXfa: true,
});
await loadingTask.destroy();
});
it("gets page", async function () {
const data = await pdfDocument.getPage(1);
expect(data instanceof PDFPageProxy).toEqual(true);