mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +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);
|
||||
}
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
|
@ -561,3 +561,4 @@
|
|||
!issue15753.pdf
|
||||
!issue15789.pdf
|
||||
!fields_order.pdf
|
||||
!issue15815.pdf
|
||||
|
|
BIN
test/pdfs/issue15815.pdf
Executable file
BIN
test/pdfs/issue15815.pdf
Executable file
Binary file not shown.
|
@ -7240,5 +7240,32 @@
|
|||
"value": "مرحبا بالعالم"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "issue15815-print",
|
||||
"file": "pdfs/issue15815.pdf",
|
||||
"md5": "48b8b057954d5b773421ac03b7fcd738",
|
||||
"rounds": 1,
|
||||
"type": "eq",
|
||||
"print": true,
|
||||
"annotationStorage": {
|
||||
"24R": {
|
||||
"value": "x3"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "issue15815-save-print",
|
||||
"file": "pdfs/issue15815.pdf",
|
||||
"md5": "48b8b057954d5b773421ac03b7fcd738",
|
||||
"rounds": 1,
|
||||
"type": "eq",
|
||||
"save": true,
|
||||
"print": true,
|
||||
"annotationStorage": {
|
||||
"24R": {
|
||||
"value": "x2"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue