mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-24 09:08:07 +02:00
[Editor] Scale the signature editor when it's too large (bug 1948741)
This commit is contained in:
parent
affce70a09
commit
3fc6b1321f
2 changed files with 48 additions and 0 deletions
|
@ -16,6 +16,7 @@
|
|||
import {
|
||||
closePages,
|
||||
getEditorSelector,
|
||||
getRect,
|
||||
loadAndWait,
|
||||
switchToEditor,
|
||||
waitForTimeout,
|
||||
|
@ -207,4 +208,46 @@ describe("Signature Editor", () => {
|
|||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Bug 1948741", () => {
|
||||
let pages;
|
||||
|
||||
beforeEach(async () => {
|
||||
pages = await loadAndWait("empty.pdf", ".annotationEditorLayer");
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await closePages(pages);
|
||||
});
|
||||
|
||||
it("must check that the editor isn't too large", async () => {
|
||||
await Promise.all(
|
||||
pages.map(async ([_, page]) => {
|
||||
await switchToSignature(page);
|
||||
await page.click("#editorSignatureAddSignature");
|
||||
|
||||
await page.waitForSelector("#addSignatureDialog", {
|
||||
visible: true,
|
||||
});
|
||||
await page.type(
|
||||
"#addSignatureTypeInput",
|
||||
"[18:50:03] asset pdf.scripting.mjs 105 KiB [emitted] [javascript module] (name: main)"
|
||||
);
|
||||
await page.waitForSelector(`${addButtonSelector}:not(:disabled)`);
|
||||
await page.click("#addSignatureAddButton");
|
||||
|
||||
const editorSelector = getEditorSelector(0);
|
||||
await page.waitForSelector(editorSelector, { visible: true });
|
||||
await page.waitForSelector(
|
||||
`.canvasWrapper > svg use[href="#path_p1_0"]`,
|
||||
{ visible: true }
|
||||
);
|
||||
|
||||
const { width } = await getRect(page, editorSelector);
|
||||
const { width: pageWidth } = await getRect(page, ".page");
|
||||
expect(width).toBeLessThanOrEqual(pageWidth);
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue