mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
Merge pull request #16563 from calixteman/bug1838855
Guess that a checkbox belongs to a group in using its T value (bug 1838855)
This commit is contained in:
commit
a5c10b6d89
5 changed files with 76 additions and 4 deletions
|
@ -120,6 +120,46 @@ describe("Checkbox annotation", () => {
|
|||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("f1040_2022.pdf", () => {
|
||||
let pages;
|
||||
|
||||
beforeAll(async () => {
|
||||
pages = await loadAndWait(
|
||||
"f1040_2022.pdf",
|
||||
"[data-annotation-id='1566R']"
|
||||
);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await closePages(pages);
|
||||
});
|
||||
|
||||
it("must check the checkbox", async () => {
|
||||
await Promise.all(
|
||||
pages.map(async ([_browserName, page]) => {
|
||||
const selectors = [1566, 1568, 1569, 1570, 1571].map(
|
||||
id => `[data-annotation-id='${id}R']`
|
||||
);
|
||||
for (const selector of selectors) {
|
||||
await page.click(selector);
|
||||
for (const otherSelector of selectors) {
|
||||
if (otherSelector === selector) {
|
||||
await page.waitForFunction(
|
||||
`document.querySelector("${selector} > :first-child").checked`
|
||||
);
|
||||
} else {
|
||||
await page.waitForFunction(
|
||||
`!document.querySelector("${otherSelector} > :first-child").checked`
|
||||
);
|
||||
}
|
||||
}
|
||||
page.waitForTimeout(10);
|
||||
}
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("Text widget", () => {
|
||||
|
|
|
@ -1491,6 +1491,22 @@ describe("api", function () {
|
|||
await loadingTask.destroy();
|
||||
});
|
||||
|
||||
it("check field object for group of buttons", async function () {
|
||||
if (isNodeJS) {
|
||||
pending("Linked test-cases are not supported in Node.js.");
|
||||
}
|
||||
|
||||
const loadingTask = getDocument(buildGetDocumentParams("f1040_2022.pdf"));
|
||||
const pdfDoc = await loadingTask.promise;
|
||||
const fieldObjects = await pdfDoc.getFieldObjects();
|
||||
|
||||
expect(
|
||||
fieldObjects["topmostSubform[0].Page1[0].c1_01"].map(o => o.id)
|
||||
).toEqual(["1566R", "1568R", "1569R", "1570R", "1571R"]);
|
||||
|
||||
await loadingTask.destroy();
|
||||
});
|
||||
|
||||
it("gets non-existent calculationOrder", async function () {
|
||||
const calculationOrder = await pdfDocument.getCalculationOrderIds();
|
||||
expect(calculationOrder).toEqual(null);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue