mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
[JS] By default, a text field value must be treated as a number (bug 1802888)
This commit is contained in:
parent
33f9d1aab2
commit
ae7da6ae48
6 changed files with 57 additions and 8 deletions
|
@ -1562,4 +1562,40 @@ describe("Interaction", () => {
|
|||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("in bug1802888.pdf", () => {
|
||||
let pages;
|
||||
|
||||
beforeAll(async () => {
|
||||
pages = await loadAndWait("bug1802888.pdf", getSelector("30R"));
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await closePages(pages);
|
||||
});
|
||||
|
||||
it("must check field value is treated by default as a number", async () => {
|
||||
await Promise.all(
|
||||
pages.map(async ([browserName, page]) => {
|
||||
await page.waitForFunction(
|
||||
"window.PDFViewerApplication.scriptingReady === true"
|
||||
);
|
||||
|
||||
await page.type(getSelector("30R"), "123", {
|
||||
delay: 10,
|
||||
});
|
||||
await page.click(getSelector("31R"));
|
||||
await page.type(getSelector("31R"), "456", {
|
||||
delay: 10,
|
||||
});
|
||||
await page.click(getSelector("26R"));
|
||||
await page.click(getSelector("27R"));
|
||||
await page.waitForFunction(`${getQuerySelector("26R")}.value !== ""`);
|
||||
|
||||
const value = await page.$eval(getSelector("26R"), el => el.value);
|
||||
expect(value).withContext(`In ${browserName}`).toEqual("579");
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
|
@ -556,3 +556,4 @@
|
|||
!textfields.pdf
|
||||
!freetext_no_appearance.pdf
|
||||
!issue15690.pdf
|
||||
!bug1802888.pdf
|
||||
|
|
BIN
test/pdfs/bug1802888.pdf
Executable file
BIN
test/pdfs/bug1802888.pdf
Executable file
Binary file not shown.
|
@ -346,7 +346,7 @@ describe("Scripting", function () {
|
|||
expect(send_queue.has(refId)).toEqual(true);
|
||||
expect(send_queue.get(refId)).toEqual({
|
||||
id: refId,
|
||||
value: "123",
|
||||
value: 123,
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -826,7 +826,7 @@ describe("Scripting", function () {
|
|||
expect(send_queue.get(refId)).toEqual({
|
||||
id: refId,
|
||||
siblings: null,
|
||||
value: "123456.789",
|
||||
value: 123456.789,
|
||||
formattedValue: null,
|
||||
});
|
||||
});
|
||||
|
@ -1006,7 +1006,7 @@ describe("Scripting", function () {
|
|||
expect(send_queue.get(refId)).toEqual({
|
||||
id: refId,
|
||||
siblings: null,
|
||||
value: "321",
|
||||
value: 321,
|
||||
formattedValue: null,
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue