Merge pull request #15598 from calixteman/15597

[Annotation] Replace use of id by data-element-id to have the correct id
This commit is contained in:
Jonas Jenwald 2022-10-20 00:01:24 +02:00 committed by GitHub
commit f3949ba69d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 1 deletions

View File

@ -551,7 +551,8 @@ class AnnotationElement {
// Fallback to a regular DOM lookup, to ensure that the standalone
// viewer components won't break.
for (const domElement of document.getElementsByName(name)) {
const { id, exportValue } = domElement;
const { exportValue } = domElement;
const id = domElement.getAttribute("data-element-id");
if (id === skipId) {
continue;
}

View File

@ -95,6 +95,31 @@ describe("Checkbox annotation", () => {
);
});
});
describe("issue15597.pdf", () => {
let pages;
beforeAll(async () => {
pages = await loadAndWait("issue15597.pdf", "[data-annotation-id='7R']");
});
afterAll(async () => {
await closePages(pages);
});
it("must check the checkbox", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
const selector = "[data-annotation-id='7R']";
await page.click(selector);
await page.waitForFunction(
`document.querySelector("${selector} > :first-child").checked`
);
expect(true).withContext(`In ${browserName}`).toEqual(true);
})
);
});
});
});
describe("Text widget", () => {

View File

@ -547,3 +547,4 @@
!bug1782564.pdf
!issue15340.pdf
!bug1795263.pdf
!issue15597.pdf

BIN
test/pdfs/issue15597.pdf Executable file

Binary file not shown.