MCPcopy Index your code
hub / github.com/angular/angular / expectText

Function expectText

packages/private/testing/src/utils.ts:245–258  ·  view source on GitHub ↗
(
  text: string | RegExp,
  options: ExpectTextOptions = {},
)

Source from the content-addressed store, hash-verified

243 * ```
244 */
245export async function expectText(
246 text: string | RegExp,
247 options: ExpectTextOptions = {},
248): Promise<void> {
249 const container = options.container || TestBed.getLastFixture().nativeElement;
250 await waitFor(() => {
251 const content = container.textContent || '';
252 if (typeof text === 'string') {
253 throwUnless(content).toContain(text);
254 } else {
255 throwUnless(text.test(content)).toBeTrue();
256 }
257 }, options);
258}
259
260// Intentionally does not participate in fake clocks.
261const realNow = performance.now.bind(performance);

Calls 3

waitForFunction · 0.70
getLastFixtureMethod · 0.65
testMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…