Skip to content

Commit

Permalink
docs: fix nested union handling (#5341)
Browse files Browse the repository at this point in the history
  • Loading branch information
yury-s committed Feb 6, 2021
1 parent 983e043 commit a1b3164
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/src/api/class-elementhandle.md
Expand Up @@ -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.

Expand Down
11 changes: 7 additions & 4 deletions utils/doclint/documentation.js
Expand Up @@ -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;
}

Expand Down

0 comments on commit a1b3164

Please sign in to comment.