mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
Merge pull request #16433 from calixteman/bug1825002
For text widgets, get the text from the AP stream instead of from the format callback (bug 1825002)
This commit is contained in:
commit
839be801a0
7 changed files with 93 additions and 35 deletions
|
@ -1897,4 +1897,70 @@ describe("Interaction", () => {
|
|||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("in bug1825002.pdf", () => {
|
||||
let pages;
|
||||
|
||||
beforeAll(async () => {
|
||||
pages = await loadAndWait("bug1825002.pdf", getSelector("23R"));
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await closePages(pages);
|
||||
});
|
||||
|
||||
it("must check that a field has the correct formatted value", async () => {
|
||||
await Promise.all(
|
||||
pages.map(async ([browserName, page]) => {
|
||||
await page.waitForFunction(
|
||||
"window.PDFViewerApplication.scriptingReady === true"
|
||||
);
|
||||
|
||||
let text = await page.$eval(getSelector("23R"), el => el.value);
|
||||
expect(text)
|
||||
.withContext(`In ${browserName}`)
|
||||
.toEqual("ABCDEFGHIJKLMN");
|
||||
|
||||
await page.click(getSelector("23R"));
|
||||
await page.waitForFunction(
|
||||
`${getQuerySelector("23R")}.value !== "ABCDEFGHIJKLMN"`
|
||||
);
|
||||
|
||||
text = await page.$eval(getSelector("23R"), el => el.value);
|
||||
expect(text).withContext(`In ${browserName}`).toEqual("123,45.7A");
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
it("must check that a field is empty", async () => {
|
||||
await Promise.all(
|
||||
pages.map(async ([browserName, page]) => {
|
||||
await page.waitForFunction(
|
||||
"window.PDFViewerApplication.scriptingReady === true"
|
||||
);
|
||||
|
||||
let text = await page.$eval(getSelector("26R"), el => el.value);
|
||||
expect(text).withContext(`In ${browserName}`).toEqual("");
|
||||
|
||||
await page.click(getSelector("26R"));
|
||||
await page.type(getSelector("26R"), "abcde", { delay: 10 });
|
||||
|
||||
await page.click(getSelector("23R"));
|
||||
await page.waitForTimeout(10);
|
||||
await page.click(getSelector("26R"));
|
||||
|
||||
await page.keyboard.down("Control");
|
||||
await page.keyboard.press("A");
|
||||
await page.keyboard.up("Control");
|
||||
await page.keyboard.press("Backspace");
|
||||
|
||||
await page.click(getSelector("23R"));
|
||||
await page.waitForTimeout(10);
|
||||
|
||||
text = await page.$eval(getSelector("26R"), el => el.value);
|
||||
expect(text).withContext(`In ${browserName}`).toEqual("");
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
|
@ -591,3 +591,4 @@
|
|||
!issue16316.pdf
|
||||
!issue14565.pdf
|
||||
!multiline.pdf
|
||||
!bug1825002.pdf
|
||||
|
|
BIN
test/pdfs/bug1825002.pdf
Executable file
BIN
test/pdfs/bug1825002.pdf
Executable file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue