(snapshot)
| 1705 | } |
| 1706 | |
| 1707 | function compactQueryNodes(snapshot) { |
| 1708 | const nodes = []; |
| 1709 | const visit = (node) => { |
| 1710 | if (!node || typeof node !== "object") { |
| 1711 | return; |
| 1712 | } |
| 1713 | if ( |
| 1714 | "role" in node || |
| 1715 | "id" in node || |
| 1716 | "label" in node || |
| 1717 | "value" in node || |
| 1718 | "frame" in node |
| 1719 | ) { |
| 1720 | nodes.push(node); |
| 1721 | } |
| 1722 | for (const child of Array.isArray(node.children) ? node.children : []) { |
| 1723 | visit(child); |
| 1724 | } |
| 1725 | }; |
| 1726 | for (const match of Array.isArray(snapshot?.matches) |
| 1727 | ? snapshot.matches |
| 1728 | : []) { |
| 1729 | visit(match); |
| 1730 | } |
| 1731 | return nodes; |
| 1732 | } |
| 1733 | |
| 1734 | function validFrame(frame) { |
| 1735 | return ( |
no test coverage detected