mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
[Annotation] Replace use of id by data-element-id to have the correct id
This commit is contained in:
parent
ba3a0e104a
commit
6db9cefaaf
4 changed files with 28 additions and 1 deletions
|
@ -551,7 +551,8 @@ class AnnotationElement {
|
||||||
// Fallback to a regular DOM lookup, to ensure that the standalone
|
// Fallback to a regular DOM lookup, to ensure that the standalone
|
||||||
// viewer components won't break.
|
// viewer components won't break.
|
||||||
for (const domElement of document.getElementsByName(name)) {
|
for (const domElement of document.getElementsByName(name)) {
|
||||||
const { id, exportValue } = domElement;
|
const { exportValue } = domElement;
|
||||||
|
const id = domElement.getAttribute("data-element-id");
|
||||||
if (id === skipId) {
|
if (id === skipId) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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", () => {
|
describe("Text widget", () => {
|
||||||
|
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
|
@ -547,3 +547,4 @@
|
||||||
!bug1782564.pdf
|
!bug1782564.pdf
|
||||||
!issue15340.pdf
|
!issue15340.pdf
|
||||||
!bug1795263.pdf
|
!bug1795263.pdf
|
||||||
|
!issue15597.pdf
|
||||||
|
|
BIN
test/pdfs/issue15597.pdf
Executable file
BIN
test/pdfs/issue15597.pdf
Executable file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue