(
nodes: SnapshotState['nodes'],
chain: SelectorChain,
options: {
platform: Platform | PublicPlatform;
requireRect?: boolean;
},
)
| 55 | } |
| 56 | |
| 57 | export function findSelectorChainMatch( |
| 58 | nodes: SnapshotState['nodes'], |
| 59 | chain: SelectorChain, |
| 60 | options: { |
| 61 | platform: Platform | PublicPlatform; |
| 62 | requireRect?: boolean; |
| 63 | }, |
| 64 | ): { |
| 65 | selectorIndex: number; |
| 66 | selector: Selector; |
| 67 | matches: number; |
| 68 | diagnostics: SelectorDiagnostics[]; |
| 69 | } | null { |
| 70 | const requireRect = options.requireRect ?? false; |
| 71 | const diagnostics: SelectorDiagnostics[] = []; |
| 72 | for (const [i, selector] of chain.selectors.entries()) { |
| 73 | const matches = countSelectorMatchesOnly(nodes, selector, options.platform, requireRect); |
| 74 | diagnostics.push({ selector: selector.raw, matches }); |
| 75 | if (matches > 0) { |
| 76 | return { selectorIndex: i, selector, matches, diagnostics }; |
| 77 | } |
| 78 | } |
| 79 | return null; |
| 80 | } |
| 81 | |
| 82 | export function formatSelectorFailure( |
| 83 | chain: SelectorChain, |
no test coverage detected