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

[JS] Update siblings when a field is updated after a calculation (#15092)

This commit is contained in:
Calixte Denizet 2022-06-24 14:23:06 +02:00
parent eace7e4c63
commit a334a21a1d
5 changed files with 58 additions and 1 deletions

View file

@ -1413,7 +1413,7 @@ describe("Interaction", () => {
await closePages(pages);
});
it("must check that data-annotation-rotation is correc", async () => {
it("must check that data-annotation-rotation is correct", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
await page.waitForFunction(
@ -1444,4 +1444,52 @@ describe("Interaction", () => {
);
});
});
describe("in issue15092.pdf", () => {
let pages;
beforeAll(async () => {
pages = await loadAndWait("issue15092.pdf", getSelector("39R"));
});
afterAll(async () => {
await closePages(pages);
});
it("must check that a values is correctly updated on a field and its siblings", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
await page.waitForFunction(
"window.PDFViewerApplication.scriptingReady === true"
);
await clearInput(page, getSelector("39R"));
await page.type(getSelector("39R"), "123", { delay: 10 });
const prevTotal = await page.$eval(
getSelector("43R"),
el => el.value
);
await clearInput(page, getSelector("42R"));
await page.type(getSelector("42R"), "456", { delay: 10 });
await page.click(getSelector("45R"));
await page.waitForFunction(
`${getQuerySelector("43R")}.value !== "${prevTotal}"`
);
await page.waitForFunction(
`${getQuerySelector("46R")}.value !== "${prevTotal}"`
);
let total = await page.$eval(getSelector("43R"), el => el.value);
expect(total).withContext(`In ${browserName}`).toEqual("579.00");
total = await page.$eval(getSelector("46R"), el => el.value);
expect(total).withContext(`In ${browserName}`).toEqual("579.00");
})
);
});
});
});

View file

@ -529,3 +529,4 @@
!bug1724918.pdf
!issue15053.pdf
!bug1675139.pdf
!issue15092.pdf

BIN
test/pdfs/issue15092.pdf Executable file

Binary file not shown.