docs(csharp): events convention based naming fix for csharp (#5238)

* docs(gen): Updating events names to camelCase.
* docs(gen): updating generator to match new assumption for event names
* docs(gen): renaming references to events
This commit is contained in:
Anže Vodovnik 2021-02-04 19:34:09 +01:00 committed by GitHub
parent cf96b15051
commit ff06399afd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 28 additions and 27 deletions

View file

@ -16,7 +16,7 @@ background_page = await context.wait_for_event("backgroundpage")
background_page = context.wait_for_event("backgroundpage") background_page = context.wait_for_event("backgroundpage")
``` ```
## event: ChromiumBrowserContext.backgroundpage ## event: ChromiumBrowserContext.backgroundPage
- type: <[Page]> - type: <[Page]>
Emitted when new background page is created in the context. Emitted when new background page is created in the context.
@ -25,7 +25,7 @@ Emitted when new background page is created in the context.
Only works with persistent context. Only works with persistent context.
::: :::
## event: ChromiumBrowserContext.serviceworker ## event: ChromiumBrowserContext.serviceWorker
- type: <[Worker]> - type: <[Worker]>
Emitted when new service worker is created in the context. Emitted when new service worker is created in the context.

View file

@ -1,6 +1,6 @@
# class: FileChooser # class: FileChooser
[FileChooser] objects are dispatched by the page in the [`event: Page.filechooser`] event. [FileChooser] objects are dispatched by the page in the [`event: Page.fileChooser`] event.
```js ```js
const [fileChooser] = await Promise.all([ const [fileChooser] = await Promise.all([

View file

@ -4,10 +4,10 @@ At every point of time, page exposes its current frame tree via the [`method: Pa
[`method: Frame.childFrames`] methods. [`method: Frame.childFrames`] methods.
[Frame] object's lifecycle is controlled by three events, dispatched on the page object: [Frame] object's lifecycle is controlled by three events, dispatched on the page object:
* [`event: Page.frameattached`] - fired when the frame gets attached to the page. A Frame can be attached to the page * [`event: Page.frameAttached`] - fired when the frame gets attached to the page. A Frame can be attached to the page
only once. only once.
* [`event: Page.framenavigated`] - fired when the frame commits navigation to a different URL. * [`event: Page.frameNavigated`] - fired when the frame commits navigation to a different URL.
* [`event: Page.framedetached`] - fired when the frame gets detached from the page. A Frame can be detached from the * [`event: Page.frameDetached`] - fired when the frame gets detached from the page. A Frame can be detached from the
page only once. page only once.
An example of dumping frame tree: An example of dumping frame tree:

View file

@ -177,7 +177,7 @@ Emitted when a JavaScript dialog appears, such as `alert`, `prompt`, `confirm` o
When no [`event: Page.dialog`] listeners are present, all dialogs are automatically dismissed. When no [`event: Page.dialog`] listeners are present, all dialogs are automatically dismissed.
::: :::
## event: Page.domcontentloaded ## event: Page.DOMContentLoaded
- type: <[Page]> - type: <[Page]>
Emitted when the JavaScript [`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded) Emitted when the JavaScript [`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded)
@ -195,7 +195,7 @@ downloaded content. If [`option: acceptDownloads`] is not set, download events a
not performed and user has no access to the downloaded files. not performed and user has no access to the downloaded files.
::: :::
## event: Page.filechooser ## event: Page.fileChooser
- type: <[FileChooser]> - type: <[FileChooser]>
Emitted when a file chooser is supposed to appear, such as after clicking the `<input type=file>`. Playwright can Emitted when a file chooser is supposed to appear, such as after clicking the `<input type=file>`. Playwright can
@ -211,17 +211,17 @@ page.on('filechooser', async (fileChooser) => {
page.on("filechooser", lambda file_chooser: file_chooser.set_files("/tmp/myfile.pdf")) page.on("filechooser", lambda file_chooser: file_chooser.set_files("/tmp/myfile.pdf"))
``` ```
## event: Page.frameattached ## event: Page.frameAttached
- type: <[Frame]> - type: <[Frame]>
Emitted when a frame is attached. Emitted when a frame is attached.
## event: Page.framedetached ## event: Page.frameDetached
- type: <[Frame]> - type: <[Frame]>
Emitted when a frame is detached. Emitted when a frame is detached.
## event: Page.framenavigated ## event: Page.frameNavigated
- type: <[Frame]> - type: <[Frame]>
Emitted when a frame is navigated to a new url. Emitted when a frame is navigated to a new url.
@ -231,7 +231,7 @@ Emitted when a frame is navigated to a new url.
Emitted when the JavaScript [`load`](https://developer.mozilla.org/en-US/docs/Web/Events/load) event is dispatched. Emitted when the JavaScript [`load`](https://developer.mozilla.org/en-US/docs/Web/Events/load) event is dispatched.
## event: Page.pageerror ## event: Page.pageError
- type: <[Error]> - type: <[Error]>
Emitted when an uncaught exception happens within the page. Emitted when an uncaught exception happens within the page.
@ -279,17 +279,17 @@ cases).
Emitted when a page issues a request. The [request] object is read-only. In order to intercept and mutate requests, see Emitted when a page issues a request. The [request] object is read-only. In order to intercept and mutate requests, see
[`method: Page.route`] or [`method: BrowserContext.route`]. [`method: Page.route`] or [`method: BrowserContext.route`].
## event: Page.requestfailed ## event: Page.requestFailed
- type: <[Request]> - type: <[Request]>
Emitted when a request fails, for example by timing out. Emitted when a request fails, for example by timing out.
:::note :::note
HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete
with [`event: Page.requestfinished`] event and not with [`event: Page.requestfailed`]. with [`event: Page.requestFinished`] event and not with [`event: Page.requestFailed`].
::: :::
## event: Page.requestfinished ## event: Page.requestFinished
- type: <[Request]> - type: <[Request]>
Emitted when a request finishes successfully after downloading the response body. For a successful response, the Emitted when a request finishes successfully after downloading the response body. For a successful response, the
@ -301,7 +301,7 @@ sequence of events is `request`, `response` and `requestfinished`.
Emitted when [response] status and headers are received for a request. For a successful response, the sequence of events Emitted when [response] status and headers are received for a request. For a successful response, the sequence of events
is `request`, `response` and `requestfinished`. is `request`, `response` and `requestfinished`.
## event: Page.websocket ## event: Page.webSocket
- type: <[WebSocket]> - type: <[WebSocket]>
Emitted when <[WebSocket]> request is sent. Emitted when <[WebSocket]> request is sent.

View file

@ -3,10 +3,10 @@
Whenever the page sends a request for a network resource the following sequence of events are emitted by [Page]: Whenever the page sends a request for a network resource the following sequence of events are emitted by [Page]:
* [`event: Page.request`] emitted when the request is issued by the page. * [`event: Page.request`] emitted when the request is issued by the page.
* [`event: Page.response`] emitted when/if the response status and headers are received for the request. * [`event: Page.response`] emitted when/if the response status and headers are received for the request.
* [`event: Page.requestfinished`] emitted when the response body is downloaded and the request is complete. * [`event: Page.requestFinished`] emitted when the response body is downloaded and the request is complete.
If request fails at some point, then instead of `'requestfinished'` event (and possibly instead of 'response' event), If request fails at some point, then instead of `'requestfinished'` event (and possibly instead of 'response' event),
the [`event: Page.requestfailed`] event is emitted. the [`event: Page.requestFailed`] event is emitted.
:::note :::note
HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete

View file

@ -7,19 +7,19 @@ The [WebSocket] class represents websocket connections in the page.
Fired when the websocket closes. Fired when the websocket closes.
## event: WebSocket.framereceived ## event: WebSocket.frameReceived
- type: <[Object]> - type: <[Object]>
- `payload` <[string]|[Buffer]> frame payload - `payload` <[string]|[Buffer]> frame payload
Fired when the websocket recieves a frame. Fired when the websocket recieves a frame.
## event: WebSocket.framesent ## event: WebSocket.frameSent
- type: <[Object]> - type: <[Object]>
- `payload` <[string]|[Buffer]> frame payload - `payload` <[string]|[Buffer]> frame payload
Fired when the websocket sends a frame. Fired when the websocket sends a frame.
## event: WebSocket.socketerror ## event: WebSocket.socketError
- type: <[String]> - type: <[String]>
Fired when the websocket has an error. Fired when the websocket has an error.

View file

@ -487,7 +487,7 @@ page.set_input_files(
) )
``` ```
If you don't have input element in hand (it is created dynamically), you can handle the [`event: Page.filechooser`] event If you don't have input element in hand (it is created dynamically), you can handle the [`event: Page.fileChooser`] event
or use a corresponding waiting method upon your action: or use a corresponding waiting method upon your action:
```js ```js

View file

@ -21,7 +21,7 @@ navigation succeeds, page starts **loading** the document.
events: events:
- [`method: Page.url`] is set to the new url - [`method: Page.url`] is set to the new url
- document content is loaded over network and parsed - document content is loaded over network and parsed
- [`event: Page.domcontentloaded`] event is fired - [`event: Page.DOMContentLoaded`] event is fired
- page executes some scripts and loads resources like stylesheets and images - page executes some scripts and loads resources like stylesheets and images
- [`event: Page.load`] event is fired - [`event: Page.load`] event is fired
- page executes dynamically loaded scripts - page executes dynamically loaded scripts

View file

@ -108,7 +108,7 @@ page.goto("data:text/html,<script>throw new Error('test')</script>")
### API reference ### API reference
- [Page] - [Page]
- [`event: Page.pageerror`] - [`event: Page.pageError`]
<br/> <br/>
@ -161,6 +161,6 @@ popup = popup_info.value
### API reference ### API reference
- [Page] - [Page]
- [`event: Page.requestfailed`] - [`event: Page.requestFailed`]
- [`event: Page.dialog`] - [`event: Page.dialog`]
- [`event: Page.popup`] - [`event: Page.popup`]

View file

@ -54,7 +54,7 @@ let hadChanges = false;
if (member.kind === 'method') if (member.kind === 'method')
return createMemberLink(member.clazz, `${member.clazz.varName}.${member.alias}(${renderJSSignature(member.argsArray)})`); return createMemberLink(member.clazz, `${member.clazz.varName}.${member.alias}(${renderJSSignature(member.argsArray)})`);
if (member.kind === 'event') if (member.kind === 'event')
return createMemberLink(member.clazz, `${member.clazz.varName}.on('${member.alias}')`); return createMemberLink(member.clazz, `${member.clazz.varName}.on('${member.alias.toLowerCase()}')`);
if (member.kind === 'property') if (member.kind === 'property')
return createMemberLink(member.clazz, `${member.clazz.varName}.${member.alias}`); return createMemberLink(member.clazz, `${member.clazz.varName}.${member.alias}`);
throw new Error('Unknown member kind ' + member.kind); throw new Error('Unknown member kind ' + member.kind);
@ -184,7 +184,8 @@ function createEventDescriptions(classDesc) {
if (!hasUniqueEvents(classDesc)) if (!hasUniqueEvents(classDesc))
return []; return [];
const descriptions = []; const descriptions = [];
for (const [eventName, value] of classDesc.events) { for (let [eventName, value] of classDesc.events) {
eventName = eventName.toLowerCase();
const type = stringifyComplexType(value && value.type, '', classDesc.name, eventName, 'payload'); const type = stringifyComplexType(value && value.type, '', classDesc.name, eventName, 'payload');
const argName = argNameForType(type); const argName = argNameForType(type);
const params = argName ? `${argName}: ${type}` : ''; const params = argName ? `${argName}: ${type}` : '';