mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
The annotation layer dimensions must be set before adding some elements (follow-up of #15770)
In order to move the annotations in the DOM to have something which corresponds to the visual order, we need to have their dimensions/positions which means that the parent must have some dimensions.
This commit is contained in:
parent
0fdac9ba70
commit
1a397681fe
4 changed files with 36 additions and 2 deletions
|
@ -106,4 +106,37 @@ describe("accessibility", () => {
|
|||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Annotations order", () => {
|
||||
let pages;
|
||||
|
||||
beforeAll(async () => {
|
||||
pages = await loadAndWait("fields_order.pdf", ".annotationLayer");
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await closePages(pages);
|
||||
});
|
||||
|
||||
it("must check that the text fields are in the visual order", async () => {
|
||||
await Promise.all(
|
||||
pages.map(async ([browserName, page]) => {
|
||||
const ids = await page.evaluate(() => {
|
||||
const elements = document.querySelectorAll(
|
||||
".annotationLayer .textWidgetAnnotation"
|
||||
);
|
||||
const results = [];
|
||||
for (const element of elements) {
|
||||
results.push(element.getAttribute("data-annotation-id"));
|
||||
}
|
||||
return results;
|
||||
});
|
||||
|
||||
expect(ids)
|
||||
.withContext(`In ${browserName}`)
|
||||
.toEqual(["32R", "30R", "31R", "34R", "29R", "33R"]);
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
|
@ -560,3 +560,4 @@
|
|||
!issue15759.pdf
|
||||
!issue15753.pdf
|
||||
!issue15789.pdf
|
||||
!fields_order.pdf
|
||||
|
|
BIN
test/pdfs/fields_order.pdf
Executable file
BIN
test/pdfs/fields_order.pdf
Executable file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue