File tree 1 file changed +3
-3
lines changed
projects/testing-library/tests/issues
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 1
1
import { AsyncPipe } from '@angular/common' ;
2
2
import { Component , inject , Injectable } from '@angular/core' ;
3
- import { render , screen , waitFor } from '../../src/public_api' ;
3
+ import { render , screen } from '../../src/public_api' ;
4
4
import { Observable , BehaviorSubject , map } from 'rxjs' ;
5
5
6
6
test ( 'displays username' , async ( ) => {
@@ -21,13 +21,13 @@ test('displays username', async () => {
21
21
} ) ;
22
22
23
23
// 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 ( ) ;
25
25
26
26
// emitting a second username
27
27
user . next ( { name : 'username 2' } ) ;
28
28
29
29
// 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 ( ) ;
31
31
} ) ;
32
32
33
33
@Component ( {
You can’t perform that action at this time.
0 commit comments