mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-29 15:47:57 +02:00
[JS] Handle correctly choice widgets where the display and the export values are different (issue #15815)
This commit is contained in:
parent
64786b4c93
commit
0c1ec946aa
8 changed files with 155 additions and 30 deletions
|
@ -1651,4 +1651,54 @@ describe("Interaction", () => {
|
|||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("in issue15815.pdf", () => {
|
||||
let pages;
|
||||
|
||||
beforeAll(async () => {
|
||||
pages = await loadAndWait("issue15815.pdf", getSelector("24R"));
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await closePages(pages);
|
||||
});
|
||||
|
||||
it("must check field value is correctly updated when committed with ENTER key", async () => {
|
||||
await Promise.all(
|
||||
pages.map(async ([browserName, page]) => {
|
||||
await page.waitForFunction(
|
||||
"window.PDFViewerApplication.scriptingReady === true"
|
||||
);
|
||||
|
||||
let value = "A";
|
||||
for (const [displayValue, exportValue] of [
|
||||
["B", "x2"],
|
||||
["C", "x3"],
|
||||
["A", "x1"],
|
||||
]) {
|
||||
await clearInput(page, getSelector("27R"));
|
||||
await page.select(getSelector("24R"), exportValue);
|
||||
await page.waitForFunction(
|
||||
`${getQuerySelector("27R")}.value !== ""`
|
||||
);
|
||||
const text = await page.$eval(getSelector("27R"), el => el.value);
|
||||
expect(text)
|
||||
.withContext(`In ${browserName}`)
|
||||
.toEqual(`value=${value}, changeEx=${exportValue}`);
|
||||
value = displayValue;
|
||||
}
|
||||
|
||||
for (const exportValue of ["x3", "x2", "x1"]) {
|
||||
await clearInput(page, getSelector("27R"));
|
||||
await page.type(getSelector("27R"), exportValue);
|
||||
await page.click("[data-annotation-id='28R']");
|
||||
await page.waitForTimeout(10);
|
||||
|
||||
value = await page.$eval(getSelector("24R"), el => el.value);
|
||||
expect(value).withContext(`In ${browserName}`).toEqual(exportValue);
|
||||
}
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue