mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 09:20:06 +02:00
Simplify the integration test in adding a function to turn on/off an editing tool
This commit is contained in:
parent
18a7bd60f7
commit
b6b02ccff6
5 changed files with 86 additions and 138 deletions
|
@ -581,6 +581,23 @@ async function kbFocusPrevious(page) {
|
|||
await awaitPromise(handle);
|
||||
}
|
||||
|
||||
async function switchToEditor(name, page, disable = false) {
|
||||
const modeChangedHandle = await createPromise(page, resolve => {
|
||||
window.PDFViewerApplication.eventBus.on(
|
||||
"annotationeditormodechanged",
|
||||
resolve,
|
||||
{ once: true }
|
||||
);
|
||||
});
|
||||
await page.click(`#editor${name}`);
|
||||
name = name.toLowerCase();
|
||||
await page.waitForSelector(
|
||||
".annotationEditorLayer" +
|
||||
(disable ? `:not(.${name}Editing)` : `.${name}Editing`)
|
||||
);
|
||||
await awaitPromise(modeChangedHandle);
|
||||
}
|
||||
|
||||
export {
|
||||
awaitPromise,
|
||||
clearInput,
|
||||
|
@ -622,6 +639,7 @@ export {
|
|||
pasteFromClipboard,
|
||||
scrollIntoView,
|
||||
serializeBitmapDimensions,
|
||||
switchToEditor,
|
||||
waitForAnnotationEditorLayer,
|
||||
waitForEntryInStorage,
|
||||
waitForEvent,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue