Skip to content

Commit

Permalink
feat(api): make page.isDragInterceptionEnabled a method
Browse files Browse the repository at this point in the history
Having it be a getter is surprising and inconsistent, since since the other `page.is*` APIs are just methods.

Issue: #7150
  • Loading branch information
mathiasbynens committed Jul 13, 2021
1 parent 2a403d1 commit 85410e9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions docs/api.md
Expand Up @@ -157,7 +157,7 @@
* [page.goto(url[, options])](#pagegotourl-options)
* [page.hover(selector)](#pagehoverselector)
* [page.isClosed()](#pageisclosed)
* [page.isDragInterceptionEnabled](#pageisdraginterceptionenabled)
* [page.isDragInterceptionEnabled()](#pageisdraginterceptionenabled)
* [page.isJavaScriptEnabled()](#pageisjavascriptenabled)
* [page.keyboard](#pagekeyboard)
* [page.mainFrame()](#pagemainframe)
Expand Down Expand Up @@ -2008,7 +2008,7 @@ Shortcut for [page.mainFrame().hover(selector)](#framehoverselector).

Indicates that the page has been closed.

#### page.isDragInterceptionEnabled
#### page.isDragInterceptionEnabled()

- returns: <[boolean]>

Expand Down
2 changes: 1 addition & 1 deletion src/common/JSHandle.ts
Expand Up @@ -504,7 +504,7 @@ export class ElementHandle<
*/
async drag(target: Point): Promise<Protocol.Input.DragData> {
assert(
this._page.isDragInterceptionEnabled,
this._page.isDragInterceptionEnabled(),
'Drag Interception is not enabled!'
);
await this._scrollIntoViewIfNeeded();
Expand Down
11 changes: 7 additions & 4 deletions src/common/Page.ts
Expand Up @@ -600,6 +600,13 @@ export class Page extends EventEmitter {
for (const interceptor of interceptors) interceptor.call(null, fileChooser);
}

/**
* @returns `true` if drag events are being intercepted, `false` otherwise.
*/
isDragInterceptionEnabled(): boolean {
return this._userDragInterceptionEnabled;
}

/**
* @returns `true` if the page has JavaScript enabled, `false` otherwise.
*/
Expand Down Expand Up @@ -777,10 +784,6 @@ export class Page extends EventEmitter {
return this._accessibility;
}

get isDragInterceptionEnabled(): boolean {
return this._userDragInterceptionEnabled;
}

/**
* @returns An array of all frames attached to the page.
*/
Expand Down

0 comments on commit 85410e9

Please sign in to comment.