1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-29 15:47:57 +02:00

[JS] Format all the fields if any when the document is open (bug 1766987)

- it aims to fix https://bugzilla.mozilla.org/show_bug.cgi?id=1766987.
This commit is contained in:
Calixte Denizet 2022-05-22 14:37:17 +02:00
parent 42a6217427
commit 9407adc416
4 changed files with 62 additions and 0 deletions

View file

@ -1302,4 +1302,38 @@ describe("Interaction", () => {
);
});
});
describe("in bug1766987.pdf", () => {
let pages;
beforeAll(async () => {
pages = await loadAndWait("bug1766987.pdf", "#\\37 5R");
});
afterAll(async () => {
await closePages(pages);
});
it("must check that field value is correctly formatted", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
await page.waitForFunction(
"window.PDFViewerApplication.scriptingReady === true"
);
let text = await page.$eval("#\\37 5R", el => el.value);
expect(text).withContext(`In ${browserName}`).toEqual("150.32 €");
text = await page.$eval("#\\38 2R", el => el.value);
expect(text).withContext(`In ${browserName}`).toEqual("12.74 Kwh");
text = await page.$eval("#\\39 1R", el => el.value);
expect(text).withContext(`In ${browserName}`).toEqual("352.19 Kwh");
text = await page.$eval("#\\31 01R", el => el.value);
expect(text).withContext(`In ${browserName}`).toEqual("20.57 €");
})
);
});
});
});