(
text: string | RegExp,
options: ExpectTextOptions = {},
)
| 243 | * ``` |
| 244 | */ |
| 245 | export 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. |
| 261 | const realNow = performance.now.bind(performance); |
no test coverage detected
searching dependent graphs…