Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a method to disable auto-accepting dialogs #35828

Merged
merged 3 commits into from
Oct 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/e2e-test-utils/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- Added `disablePageDialogAccept` - Disable auto-accepting dialogs enabled by `enablePageDialogAccept` [#35828](https://github.com/WordPress/gutenberg/pull/35828).

## 5.4.0 (2021-07-21)

### New Features
Expand Down
7 changes: 5 additions & 2 deletions packages/e2e-test-utils/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@ _Parameters_

Removes the focus loss listener that `enableFocusLossObservation()` adds.

### disablePageDialogAccept

Disable auto-accepting any dialogs.

### disablePrePublishChecks

Disables Pre-publish checks.
Expand All @@ -263,8 +267,7 @@ loss of focus.

### enablePageDialogAccept

Enables even listener which accepts a page dialog which
may appear when navigating away from Gutenberg.
Enables event listener which auto-accepts all dialogs on the page.

### enablePrePublishChecks

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ async function acceptPageDialog( dialog ) {
await dialog.accept();
}
/**
* Enables even listener which accepts a page dialog which
* may appear when navigating away from Gutenberg.
* Enables event listener which auto-accepts all dialogs on the page.
*/
export function enablePageDialogAccept() {
page.on( 'dialog', acceptPageDialog );
}
/**
* Disable auto-accepting any dialogs.
*/
export function disablePageDialogAccept() {
page.off( 'dialog', acceptPageDialog );
}
5 changes: 4 additions & 1 deletion packages/e2e-test-utils/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ export { deleteTheme } from './delete-theme';
export { deleteUser } from './delete-user';
export { disablePrePublishChecks } from './disable-pre-publish-checks';
export { dragAndResize } from './drag-and-resize';
export { enablePageDialogAccept } from './enable-page-dialog-accept';
export {
enablePageDialogAccept,
disablePageDialogAccept,
} from './auto-accept-page-dialogs';
export { enablePrePublishChecks } from './enable-pre-publish-checks';
export { ensureSidebarOpened } from './ensure-sidebar-opened';
export { findSidebarPanelToggleButtonWithTitle } from './find-sidebar-panel-toggle-button-with-title';
Expand Down