mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
[JS] Fix several issues found in pdf in #13269
- app.alert and few other function can use an object as parameter ({cMsg: ...}); - support app.alert with a question and a yes/no answer; - update field siblings when one is changed in an action; - stop calculation if calculate is set to false in the middle of calculations; - get a boolean for checkboxes when they've been set through annotationStorage instead of a string.
This commit is contained in:
parent
3f187c2c6d
commit
3f29892d63
12 changed files with 224 additions and 50 deletions
|
@ -787,7 +787,7 @@ describe("Interaction", () => {
|
|||
`
|
||||
['Text1', 'Text2', 'Text4',
|
||||
'List Box7', 'Group6'].map(x => this.getField(x).page).join(',')
|
||||
`
|
||||
`
|
||||
);
|
||||
|
||||
// Click on execute button to eval the above code.
|
||||
|
@ -802,4 +802,43 @@ describe("Interaction", () => {
|
|||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("in issue13269.pdf", () => {
|
||||
let pages;
|
||||
|
||||
beforeAll(async () => {
|
||||
pages = await loadAndWait("issue13269.pdf", "#\\32 7R");
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await closePages(pages);
|
||||
});
|
||||
|
||||
it("must update fields with the same name from JS", async () => {
|
||||
await Promise.all(
|
||||
pages.map(async ([browserName, page]) => {
|
||||
await page.waitForFunction(
|
||||
"window.PDFViewerApplication.scriptingReady === true"
|
||||
);
|
||||
|
||||
await page.type("#\\32 7R", "hello");
|
||||
await page.keyboard.press("Enter");
|
||||
|
||||
await Promise.all(
|
||||
[4, 5, 6].map(async n =>
|
||||
page.waitForFunction(
|
||||
`document.querySelector("#\\\\32 ${n}R").value !== ""`
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
const expected = "hello world";
|
||||
for (const n of [4, 5, 6]) {
|
||||
const text = await page.$eval(`#\\32 ${n}R`, el => el.value);
|
||||
expect(text).withContext(`In ${browserName}`).toEqual(expected);
|
||||
}
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
|
@ -8,6 +8,7 @@
|
|||
!franz_2.pdf
|
||||
!fraction-highlight.pdf
|
||||
!german-umlaut-r.pdf
|
||||
!issue13269.pdf
|
||||
!xref_command_missing.pdf
|
||||
!issue1155r.pdf
|
||||
!issue2017r.pdf
|
||||
|
|
BIN
test/pdfs/issue13269.pdf
Normal file
BIN
test/pdfs/issue13269.pdf
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue