Skip to content

Commit be9c3d5

Browse files
committed
docs: add test case for #492
1 parent fbbed20 commit be9c3d5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

projects/testing-library/tests/issues/issue-492.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { AsyncPipe } from '@angular/common';
22
import { Component, inject, Injectable } from '@angular/core';
3-
import { render, screen, waitFor } from '../../src/public_api';
3+
import { render, screen } from '../../src/public_api';
44
import { Observable, BehaviorSubject, map } from 'rxjs';
55

66
test('displays username', async () => {
@@ -21,13 +21,13 @@ test('displays username', async () => {
2121
});
2222

2323
// assert first username emitted is rendered
24-
expect(await screen.findByRole('heading')).toHaveTextContent('username 1');
24+
expect(await screen.findByRole('heading', { name: 'username 1' })).toBeInTheDocument();
2525

2626
// emitting a second username
2727
user.next({ name: 'username 2' });
2828

2929
// assert the second username is rendered
30-
await waitFor(() => expect(screen.getByRole('heading')).toHaveTextContent('username 2'));
30+
expect(await screen.findByRole('heading', { name: 'username 2' })).toBeInTheDocument();
3131
});
3232

3333
@Component({

0 commit comments

Comments
 (0)