MCPcopy Create free account
hub / github.com/angular/components / _parseQueries

Function _parseQueries

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

* Parses a list of queries in the format accepted by the `locatorFor*` methods into an easier to * work with format.

(
  queries: T,
)

Source from the content-addressed store, hash-verified

439 * work with format.
440 */
441function _parseQueries<T extends (HarnessQuery<any> | string)[]>(
442 queries: T,
443): ParsedQueries<LocatorFnResult<T> & ComponentHarness> {
444 const allQueries = [];
445 const harnessQueries = [];
446 const elementQueries = [];
447 const harnessTypes = new Set<
448 ComponentHarnessConstructor<LocatorFnResult<T> & ComponentHarness>
449 >();
450
451 for (const query of queries) {
452 if (typeof query === 'string') {
453 allQueries.push(query);
454 elementQueries.push(query);
455 } else {
456 const predicate = query instanceof HarnessPredicate ? query : new HarnessPredicate(query, {});
457 allQueries.push(predicate);
458 harnessQueries.push(predicate);
459 harnessTypes.add(predicate.harnessType);
460 }
461 }
462
463 return {allQueries, harnessQueries, elementQueries, harnessTypes};
464}
465
466/**
467 * Removes duplicate query results for a particular element. (e.g. multiple `TestElement`

Callers 1

Calls 2

pushMethod · 0.65
addMethod · 0.45

Tested by

no test coverage detected