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

Set correctly the change property for the event triggered when a choice list is changed

It fixes #17998.
This commit is contained in:
Calixte Denizet 2024-04-24 13:02:03 +02:00
parent bda98b91cb
commit 55808238e4
4 changed files with 46 additions and 0 deletions

View file

@ -2425,4 +2425,47 @@ describe("Interaction", () => {
);
});
});
describe("Value of event.change when a choice list is modified", () => {
let pages;
let otherPages;
beforeAll(async () => {
otherPages = await Promise.all(
global.integrationSessions.map(async session =>
session.browser.newPage()
)
);
pages = await loadAndWait("issue17998.pdf", getSelector("7R"));
});
afterAll(async () => {
await closePages(pages);
await Promise.all(otherPages.map(page => page.close()));
});
it("must check the properties of the event", async () => {
await Promise.all(
pages.map(async ([browserName, page], i) => {
await page.waitForFunction(
"window.PDFViewerApplication.scriptingReady === true"
);
for (const [value, expected] of [
["b", "change=B,changeEx=b,value=A"],
["c", "change=C,changeEx=c,value=B"],
["a", "change=A,changeEx=a,value=C"],
]) {
await page.select(getSelector("7R"), value);
await page.waitForFunction(
`${getQuerySelector("10R")}.value !== ""`
);
const text = await page.$eval(getSelector("10R"), el => el.value);
expect(text).withContext(`In ${browserName}`).toEqual(expected);
await clearInput(page, getSelector("10R"));
}
})
);
});
});
});

View file

@ -644,3 +644,4 @@
!issue17929.pdf
!issue12213.pdf
!tracemonkey_freetext.pdf
!issue17998.pdf

BIN
test/pdfs/issue17998.pdf Executable file

Binary file not shown.