MCPcopy Index your code
hub / github.com/angular/components / _getQueryResultForElement

Function _getQueryResultForElement

src/cdk/testing/harness-environment.ts:420–434  ·  view source on GitHub ↗

* 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,
  )

Source from the content-addressed store, hash-verified

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/**

Callers

nothing calls this directly

Calls 3

getSelectorMethod · 0.80
evaluateMethod · 0.80
matchesSelectorMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…