mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
Introduce a generic clearEditors
helper function
This replaces the various copies of this logic with a single helper that we template for each editor type, similar to what we already do for the `switchToEditor` helper.
This commit is contained in:
parent
f155b69c07
commit
acc5a2153a
4 changed files with 13 additions and 21 deletions
|
@ -17,6 +17,7 @@ import {
|
|||
applyFunctionToEditor,
|
||||
awaitPromise,
|
||||
cleanupEditing,
|
||||
clearEditors,
|
||||
clearInput,
|
||||
closePages,
|
||||
copy,
|
||||
|
@ -38,7 +39,6 @@ import {
|
|||
pasteFromClipboard,
|
||||
scrollIntoView,
|
||||
selectEditor,
|
||||
selectEditors,
|
||||
serializeBitmapDimensions,
|
||||
switchToEditor,
|
||||
unselectEditor,
|
||||
|
@ -47,7 +47,6 @@ import {
|
|||
waitForEntryInStorage,
|
||||
waitForSelectedEditor,
|
||||
waitForSerialized,
|
||||
waitForStorageEntries,
|
||||
waitForTimeout,
|
||||
} from "./test_utils.mjs";
|
||||
import { fileURLToPath } from "url";
|
||||
|
@ -57,13 +56,7 @@ import { PNG } from "pngjs";
|
|||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
const selectAll = selectEditors.bind(null, "stamp");
|
||||
|
||||
const clearAll = async page => {
|
||||
await selectAll(page);
|
||||
await page.keyboard.press("Backspace");
|
||||
await waitForStorageEntries(page, 0);
|
||||
};
|
||||
const clearAll = clearEditors.bind(null, "stamp");
|
||||
|
||||
const waitForImage = async (page, selector) => {
|
||||
await page.waitForSelector(`${selector} canvas`);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue