1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

[Editor] Don't make editable an empty freetext annotation

This commit is contained in:
Calixte Denizet 2023-06-21 11:07:14 +02:00
parent 7588418b09
commit 19f7a8b899
3 changed files with 44 additions and 1 deletions

View file

@ -1116,4 +1116,42 @@ describe("FreeText Editor", () => {
}
});
});
describe("FreeText with popup", () => {
let pages;
beforeAll(async () => {
pages = await loadAndWait(
"annotation-freetext.pdf",
".annotationEditorLayer"
);
});
afterAll(async () => {
await closePages(pages);
});
it("must not remove an empty annotation", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
await page.hover("[data-annotation-id='23R']");
// Wait for the popup to be displayed.
await page.waitForFunction(
`document.querySelector("[data-annotation-id='popup_23R']").hidden === false`
);
// Enter in editing mode.
await page.click("#editorFreeText");
await page.waitForTimeout(10);
await page.click("#editorFreeText");
await page.hover("[data-annotation-id='23R']");
// Wait for the popup to be displayed.
await page.waitForFunction(
`document.querySelector("[data-annotation-id='popup_23R']").hidden === false`
);
})
);
});
});
});