docs: fix nested union handling (#5341)

This commit is contained in:
Yury Semikhatsky 2021-02-05 16:32:13 -08:00 committed by GitHub
parent 983e04374a
commit a1b3164864
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View File

@ -734,7 +734,7 @@ to pass. This method throws when the element is detached while waiting, unless w
If the element does not satisfy the condition for the [`option: timeout`] milliseconds, this method will throw.
### param: ElementHandle.waitForElementState.state
- `state` <"visible"|"hidden"|"stable"|"enabled"|"disabled"|"editable">
- `state` <[ElementStateEnum]<"visible"|"hidden"|"stable"|"enabled"|"disabled"|"editable">>
A state to wait for, see below for more details.

View File

@ -429,11 +429,14 @@ Documentation.Type = class {
*/
static fromParsedType(parsedType, inUnion = false) {
if (!inUnion && parsedType.union) {
const name = parsedType.unionName || '';
const type = new Documentation.Type(name);
const type = new Documentation.Type(parsedType.unionName || '');
type.union = [];
for (let t = parsedType; t; t = t.union)
type.union.push(Documentation.Type.fromParsedType(t, true));
for (let t = parsedType; t; t = t.union) {
const nestedUnion = !!t.unionName && t !== parsedType;
type.union.push(Documentation.Type.fromParsedType(t, !nestedUnion));
if (nestedUnion)
break;
}
return type;
}