mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
Take into account PageOpen and PageClose actions which are present in some fields
This commit is contained in:
parent
8709202021
commit
dacf8bb0d1
4 changed files with 92 additions and 5 deletions
|
@ -2456,4 +2456,58 @@ describe("Interaction", () => {
|
|||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("PageOpen and PageClose actions in fields", () => {
|
||||
let pages;
|
||||
let otherPages;
|
||||
|
||||
beforeAll(async () => {
|
||||
otherPages = await Promise.all(
|
||||
global.integrationSessions.map(async session =>
|
||||
session.browser.newPage()
|
||||
)
|
||||
);
|
||||
pages = await loadAndWait("issue18305.pdf", getSelector("7R"));
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await closePages(pages);
|
||||
await Promise.all(otherPages.map(page => page.close()));
|
||||
});
|
||||
|
||||
it("must check that PageOpen/PageClose actions are correctly executed", async () => {
|
||||
await Promise.all(
|
||||
pages.map(async ([browserName, page], i) => {
|
||||
await page.waitForFunction(
|
||||
"window.PDFViewerApplication.scriptingReady === true"
|
||||
);
|
||||
|
||||
const buttonSelector = `[data-annotation-id="25R"`;
|
||||
await page.waitForSelector(buttonSelector, {
|
||||
timeout: 0,
|
||||
});
|
||||
|
||||
const inputSelector = getSelector("7R");
|
||||
let text = await page.$eval(inputSelector, el => el.value);
|
||||
expect(text).withContext(`In ${browserName}`).toEqual("");
|
||||
|
||||
text = await actAndWaitForInput(
|
||||
page,
|
||||
inputSelector,
|
||||
() => scrollIntoView(page, buttonSelector),
|
||||
false
|
||||
);
|
||||
expect(text).withContext(`In ${browserName}`).toEqual("PageOpen");
|
||||
|
||||
text = await actAndWaitForInput(
|
||||
page,
|
||||
inputSelector,
|
||||
() => scrollIntoView(page, inputSelector),
|
||||
false
|
||||
);
|
||||
expect(text).withContext(`In ${browserName}`).toEqual("PageClose");
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
|
@ -651,3 +651,4 @@
|
|||
!pdfjs_wikipedia.pdf
|
||||
!bug1539074.pdf
|
||||
!bug1539074.1.pdf
|
||||
!issue18305.pdf
|
||||
|
|
BIN
test/pdfs/issue18305.pdf
Executable file
BIN
test/pdfs/issue18305.pdf
Executable file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue