docs: add enum aliases (#5335)
This commit is contained in:
parent
c0610ccef4
commit
4b74f5693c
|
|
@ -504,10 +504,7 @@ The file path to save the image to. The screenshot type will be inferred from fi
|
|||
relative path, then it is resolved relative to the current working directory. If no path is provided, the image won't be
|
||||
saved to the disk.
|
||||
|
||||
### option: ElementHandle.screenshot.type
|
||||
- `type` <"png"|"jpeg">
|
||||
|
||||
Specify screenshot type, defaults to `png`.
|
||||
### option: ElementHandle.screenshot.type = %%-screenshot-type-%%
|
||||
|
||||
### option: ElementHandle.screenshot.quality
|
||||
- `quality` <[int]>
|
||||
|
|
|
|||
|
|
@ -712,13 +712,13 @@ page.evaluate("matchMedia('(prefers-color-scheme: no-preference)').matches")
|
|||
```
|
||||
|
||||
### option: Page.emulateMedia.media
|
||||
- `media` <[null]|"screen"|"print">
|
||||
- `media` <null|[MediaEnum]<"screen"|"print">>
|
||||
|
||||
Changes the CSS media type of the page. The only allowed values are `'screen'`, `'print'` and `null`.
|
||||
Passing `null` disables CSS media emulation.
|
||||
|
||||
### option: Page.emulateMedia.colorScheme
|
||||
- `colorScheme` <[null]|"light"|"dark"|"no-preference">
|
||||
- `colorScheme` <null|[ColorSchemeEnum]<"light"|"dark"|"no-preference">>
|
||||
|
||||
Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. Passing
|
||||
`null` disables color scheme emulation.
|
||||
|
|
@ -1844,10 +1844,7 @@ The file path to save the image to. The screenshot type will be inferred from fi
|
|||
relative path, then it is resolved relative to the current working directory. If no path is provided, the image won't be
|
||||
saved to the disk.
|
||||
|
||||
### option: Page.screenshot.type
|
||||
- `type` <"png"|"jpeg">
|
||||
|
||||
Specify screenshot type, defaults to `png`.
|
||||
### option: Page.screenshot.type = %%-screenshot-type-%%
|
||||
|
||||
### option: Page.screenshot.quality
|
||||
- `quality` <[int]>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
## navigation-wait-until
|
||||
- `waitUntil` <"load"|"domcontentloaded"|"networkidle">
|
||||
- `waitUntil` <[WaitUntilEnum]<"load"|"domcontentloaded"|"networkidle">>
|
||||
|
||||
When to consider operation succeeded, defaults to `load`. Events can be either:
|
||||
* `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
|
||||
|
|
@ -56,13 +56,13 @@ A point to use relative to the top-left corner of element padding box. If not sp
|
|||
element.
|
||||
|
||||
## input-modifiers
|
||||
- `modifiers` <[Array]<"Alt"|"Control"|"Meta"|"Shift">>
|
||||
- `modifiers` <[Array]<[ModifierEnum]<"Alt"|"Control"|"Meta"|"Shift">>>
|
||||
|
||||
Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current
|
||||
modifiers back. If not specified, currently pressed modifiers are used.
|
||||
|
||||
## input-button
|
||||
- `button` <"left"|"right"|"middle">
|
||||
- `button` <[ButtonEnum]<"left"|"right"|"middle">>
|
||||
|
||||
Defaults to `left`.
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ defaults to 1. See [UIEvent.detail].
|
|||
A selector to query for. See [working with selectors](./selectors.md) for more details.
|
||||
|
||||
## wait-for-selector-state
|
||||
- `state` <"attached"|"detached"|"visible"|"hidden">
|
||||
- `state` <[ElementStateEnum]<"attached"|"detached"|"visible"|"hidden">>
|
||||
|
||||
Defaults to `'visible'`. Can be either:
|
||||
* `'attached'` - wait for element to be present in DOM.
|
||||
|
|
@ -321,7 +321,7 @@ Whether to emulate network being offline. Defaults to `false`.
|
|||
Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication).
|
||||
|
||||
## context-option-colorscheme
|
||||
- `colorScheme` <"light"|"dark"|"no-preference">
|
||||
- `colorScheme` <[ColorSchemeEnum]<"light"|"dark"|"no-preference">>
|
||||
|
||||
Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See
|
||||
[`method: Page.emulateMedia`] for more details. Defaults to '`light`'.
|
||||
|
|
@ -432,7 +432,7 @@ A glob pattern, regex pattern or predicate receiving [URL] to match while waitin
|
|||
Event name, same one typically passed into `*.on(event)`.
|
||||
|
||||
## wait-for-load-state-state
|
||||
- `state` <"load"|"domcontentloaded"|"networkidle">
|
||||
- `state` <[LoadStateEnum]<"load"|"domcontentloaded"|"networkidle">>
|
||||
|
||||
Optional load state to wait for, defaults to `load`. If the state has been already reached while loading current document, the
|
||||
method resolves immediately. Can be one of:
|
||||
|
|
@ -440,6 +440,11 @@ method resolves immediately. Can be one of:
|
|||
* `'domcontentloaded'` - wait for the `DOMContentLoaded` event to be fired.
|
||||
* `'networkidle'` - wait until there are no network connections for at least `500` ms.
|
||||
|
||||
## screenshot-type
|
||||
- `type` <[ScreenshotTypeEnum]<"png"|"jpeg">>
|
||||
|
||||
Specify screenshot type, defaults to `png`.
|
||||
|
||||
## java-wait-for-event-callback
|
||||
* langs: java
|
||||
- `callback` <[Runnable]>
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ const md = require('../markdown');
|
|||
* retType: ParsedType | null,
|
||||
* template: ParsedType | null,
|
||||
* union: ParsedType | null,
|
||||
* unionName?: string,
|
||||
* next: ParsedType | null,
|
||||
* }} ParsedType
|
||||
*/
|
||||
|
|
@ -428,7 +429,8 @@ Documentation.Type = class {
|
|||
*/
|
||||
static fromParsedType(parsedType, inUnion = false) {
|
||||
if (!inUnion && parsedType.union) {
|
||||
const type = new Documentation.Type('union');
|
||||
const name = parsedType.unionName || '';
|
||||
const type = new Documentation.Type(name);
|
||||
type.union = [];
|
||||
for (let t = parsedType; t; t = t.union)
|
||||
type.union.push(Documentation.Type.fromParsedType(t, true));
|
||||
|
|
@ -527,6 +529,21 @@ Documentation.Type = class {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {ParsedType} type
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function isStringUnion(type) {
|
||||
if (!type.union)
|
||||
return false;
|
||||
while (type) {
|
||||
if (!type.name.startsWith('"') || !type.name.endsWith('"'))
|
||||
return false;
|
||||
type = type.union;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} type
|
||||
* @returns {ParsedType}
|
||||
|
|
@ -571,6 +588,12 @@ function parseTypeExpression(type) {
|
|||
union = parseTypeExpression(type.substring(firstTypeLength + 1));
|
||||
else if (type[firstTypeLength] === ',')
|
||||
next = parseTypeExpression(type.substring(firstTypeLength + 1));
|
||||
|
||||
if (template && !template.unionName && isStringUnion(template)) {
|
||||
template.unionName = name;
|
||||
return template;
|
||||
}
|
||||
|
||||
return {
|
||||
name,
|
||||
args,
|
||||
|
|
|
|||
Loading…
Reference in a new issue