mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 09:20:06 +02:00
Don't show the print dialog when printing in some integration tests
This commit is contained in:
parent
e0fc1a341a
commit
b0c239a200
2 changed files with 48 additions and 41 deletions
|
@ -60,11 +60,15 @@ function loadAndWait(filename, selector, zoom, setups, options) {
|
|||
// and EventBus, so we can inject some code to do whatever we want
|
||||
// soon enough especially before the first event in the eventBus is
|
||||
// dispatched.
|
||||
const { prePageSetup, appSetup, eventBusSetup } = setups;
|
||||
const { prePageSetup, appSetup, earlySetup, eventBusSetup } = setups;
|
||||
await prePageSetup?.(page);
|
||||
if (appSetup || eventBusSetup) {
|
||||
if (earlySetup || appSetup || eventBusSetup) {
|
||||
await page.evaluateOnNewDocument(
|
||||
(aSetup, eSetup) => {
|
||||
(eaSetup, aSetup, evSetup) => {
|
||||
if (eaSetup) {
|
||||
// eslint-disable-next-line no-eval
|
||||
eval(`(${eaSetup})`)();
|
||||
}
|
||||
let app;
|
||||
let eventBus;
|
||||
Object.defineProperty(window, "PDFViewerApplication", {
|
||||
|
@ -83,13 +87,16 @@ function loadAndWait(filename, selector, zoom, setups, options) {
|
|||
},
|
||||
set(newV) {
|
||||
eventBus = newV;
|
||||
// eslint-disable-next-line no-eval
|
||||
eval(`(${eSetup})`)(eventBus);
|
||||
if (evSetup) {
|
||||
// eslint-disable-next-line no-eval
|
||||
eval(`(${evSetup})`)(eventBus);
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
earlySetup?.toString(),
|
||||
appSetup?.toString(),
|
||||
eventBusSetup?.toString()
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue