11import { 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' ;
33import userEvent from '@testing-library/user-event' ;
44
55import { DialogComponent , DialogContentComponent , DialogContentComponentModule } from './15-dialog.component' ;
@@ -42,7 +42,7 @@ test('closes the dialog via the backdrop', async () => {
4242 // eslint-disable-next-line testing-library/no-node-access, @typescript-eslint/no-non-null-assertion
4343 fireEvent . click ( document . querySelector ( '.cdk-overlay-backdrop' ) ! ) ;
4444
45- await waitForElementToBeRemoved ( ( ) => screen . queryByRole ( 'dialog' ) ) ;
45+ expect ( screen . queryByRole ( 'dialog' ) ) . not . toBeInTheDocument ( ) ;
4646
4747 const dialogTitle = screen . queryByRole ( 'heading' , { name : / d i a l o g t i t l e / i } ) ;
4848 expect ( dialogTitle ) . not . toBeInTheDocument ( ) ;
@@ -64,7 +64,7 @@ test('opens and closes the dialog with buttons', async () => {
6464 const cancelButton = await screen . findByRole ( 'button' , { name : / c a n c e l / i } ) ;
6565 userEvent . click ( cancelButton ) ;
6666
67- await waitForElementToBeRemoved ( ( ) => screen . queryByRole ( 'dialog' ) ) ;
67+ expect ( screen . queryByRole ( 'dialog' ) ) . not . toBeInTheDocument ( ) ;
6868
6969 const dialogTitle = screen . queryByRole ( 'heading' , { name : / d i a l o g t i t l e / i } ) ;
7070 expect ( dialogTitle ) . not . toBeInTheDocument ( ) ;
0 commit comments