1
1
import { MatDialogModule , MatDialogRef } from '@angular/material/dialog' ;
2
- import { render , screen , waitForElementToBeRemoved , fireEvent } from '@testing-library/angular' ;
2
+ import { render , screen , fireEvent } from '@testing-library/angular' ;
3
3
import userEvent from '@testing-library/user-event' ;
4
4
5
5
import { DialogComponent , DialogContentComponent , DialogContentComponentModule } from './15-dialog.component' ;
@@ -42,7 +42,7 @@ test('closes the dialog via the backdrop', async () => {
42
42
// eslint-disable-next-line testing-library/no-node-access, @typescript-eslint/no-non-null-assertion
43
43
fireEvent . click ( document . querySelector ( '.cdk-overlay-backdrop' ) ! ) ;
44
44
45
- await waitForElementToBeRemoved ( ( ) => screen . queryByRole ( 'dialog' ) ) ;
45
+ expect ( screen . queryByRole ( 'dialog' ) ) . not . toBeInTheDocument ( ) ;
46
46
47
47
const dialogTitle = screen . queryByRole ( 'heading' , { name : / d i a l o g t i t l e / i } ) ;
48
48
expect ( dialogTitle ) . not . toBeInTheDocument ( ) ;
@@ -64,7 +64,7 @@ test('opens and closes the dialog with buttons', async () => {
64
64
const cancelButton = await screen . findByRole ( 'button' , { name : / c a n c e l / i } ) ;
65
65
userEvent . click ( cancelButton ) ;
66
66
67
- await waitForElementToBeRemoved ( ( ) => screen . queryByRole ( 'dialog' ) ) ;
67
+ expect ( screen . queryByRole ( 'dialog' ) ) . not . toBeInTheDocument ( ) ;
68
68
69
69
const dialogTitle = screen . queryByRole ( 'heading' , { name : / d i a l o g t i t l e / i } ) ;
70
70
expect ( dialogTitle ) . not . toBeInTheDocument ( ) ;
0 commit comments