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

JS -- add support for page property in field

This commit is contained in:
Calixte Denizet 2021-04-30 16:43:27 +02:00
parent f0817015bd
commit 549aae6c3d
6 changed files with 104 additions and 9 deletions

View file

@ -762,4 +762,44 @@ describe("Interaction", () => {
);
});
});
describe("Check field properties", () => {
let pages;
beforeAll(async () => {
pages = await loadAndWait("evaljs.pdf", "#\\35 5R");
});
afterAll(async () => {
await closePages(pages);
});
it("must check page index", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
await page.waitForFunction(
"window.PDFViewerApplication.scriptingReady === true"
);
await clearInput(page, "#\\35 5R");
await page.type(
"#\\35 5R",
`
['Text1', 'Text2', 'Text4',
'List Box7', 'Group6'].map(x => this.getField(x).page).join(',')
`
);
// Click on execute button to eval the above code.
await page.click("[data-annotation-id='57R']");
await page.waitForFunction(
`document.querySelector("#\\\\35 6R").value !== ""`
);
const text = await page.$eval("#\\35 6R", el => el.value);
expect(text).withContext(`In ${browserName}`).toEqual("0,0,1,1,1");
})
);
});
});
});

View file

@ -403,6 +403,7 @@
!issue12418_reduced.pdf
!annotation-freetext.pdf
!annotation-line.pdf
!evaljs.pdf
!annotation-line-without-appearance.pdf
!bug1669099.pdf
!annotation-square-circle.pdf

BIN
test/pdfs/evaljs.pdf Normal file

Binary file not shown.