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

Function locatorForOptional

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

* Creates an asynchronous locator function that can be used to find a `ComponentHarness` instance * or element under the root element of this `HarnessEnvironmnet`. * * For example, given the following DOM and assuming `DivHarness.hostSelector` is `'div'` * * ```html *

(
    ...queries: T
  )

Source from the content-addressed store, hash-verified

134 * result types for each query or null.
135 */
136 locatorForOptional<T extends (HarnessQuery<any> | string)[]>(
137 ...queries: T
138 ): () => Promise<LocatorFnResult<T> | null> {
139 return async () => (await this._getAllHarnessesAndTestElements(queries))[0] || null;
140 }
141
142 /**
143 * Creates an asynchronous locator function that can be used to find `ComponentHarness` instances

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected