pdf.js/test/integration/thumbnail_view_spec.mjs
Calixte Denizet 423379e42f
Slightly reduce the memory used by thumbnails
In using a blob instead of a base64 string it's possible to reduce the memory.
And simplify a bit the thumbnails themselves.
2025-11-28 21:52:40 +01:00

36 lines
1005 B
JavaScript

import { closePages, loadAndWait } from "./test_utils.mjs";
describe("PDF Thumbnail View", () => {
describe("Works without errors", () => {
let pages;
beforeEach(async () => {
pages = await loadAndWait("tracemonkey.pdf", "#sidebarToggleButton");
});
afterEach(async () => {
await closePages(pages);
});
it("should render thumbnails without errors", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
await page.click("#sidebarToggleButton");
const thumbSelector = "#thumbnailView .thumbnailImage";
await page.waitForSelector(thumbSelector, { visible: true });
await page.waitForSelector(
"#thumbnailView .thumbnail:not(.missingThumbnailImage)"
);
const src = await page.$eval(thumbSelector, el => el.src);
expect(src)
.withContext(`In ${browserName}`)
.toMatch(/^blob:http:/);
})
);
});
});
});