* Check whether the given query matches the given element, if it does return the matched * `TestElement` or `ComponentHarness`, if it does not, return null. In cases where the caller * knows for sure that the query matches the element's selector, `skipSelectorCheck` can be used * to skip ve
(
query: string | HarnessPredicate<T>,
rawElement: E,
testElement: TestElement,
skipSelectorCheck: boolean = false,
)
| 418 | * to skip verification and optimize performance. |
| 419 | */ |
| 420 | private async _getQueryResultForElement<T extends ComponentHarness>( |
| 421 | query: string | HarnessPredicate<T>, |
| 422 | rawElement: E, |
| 423 | testElement: TestElement, |
| 424 | skipSelectorCheck: boolean = false, |
| 425 | ): Promise<T | TestElement | null> { |
| 426 | if (typeof query === 'string') { |
| 427 | return skipSelectorCheck || (await testElement.matchesSelector(query)) ? testElement : null; |
| 428 | } |
| 429 | if (skipSelectorCheck || (await testElement.matchesSelector(query.getSelector()))) { |
| 430 | const harness = this.createComponentHarness(query.harnessType, rawElement); |
| 431 | return (await query.evaluate(harness)) ? harness : null; |
| 432 | } |
| 433 | return null; |
| 434 | } |
| 435 | } |
| 436 | |
| 437 | /** |
nothing calls this directly
no test coverage detected
searching dependent graphs…