@@ -36,14 +36,14 @@ describe('tooltip attributes', () => {
3636
3737 await userEvent . hover ( anchorElement )
3838
39- const tooltip = await screen . findByRole ( 'tooltip' )
40- expect ( tooltip ) . toHaveAttribute ( 'style' )
41-
42- expect ( anchorElement ) . toHaveAttribute ( 'data-tooltip-content' )
4339 await waitFor ( ( ) => {
40+ const tooltip = screen . getByRole ( 'tooltip' )
41+ expect ( tooltip ) . toHaveAttribute ( 'style' )
4442 expect ( anchorElement ) . toHaveAttribute ( 'aria-describedby' , 'basic-example-attr' )
4543 } )
46- expect ( tooltip ) . toBeInTheDocument ( )
44+
45+ expect ( anchorElement ) . toHaveAttribute ( 'data-tooltip-content' )
46+ expect ( screen . getByRole ( 'tooltip' ) ) . toBeInTheDocument ( )
4747 } )
4848
4949 test ( 'tooltip with place' , async ( ) => {
@@ -58,15 +58,15 @@ describe('tooltip attributes', () => {
5858
5959 await userEvent . hover ( anchorElement )
6060
61- const tooltip = await screen . findByRole ( 'tooltip' )
62- expect ( tooltip ) . toHaveAttribute ( 'style' )
63-
64- expect ( anchorElement ) . toHaveAttribute ( 'data-tooltip-place' )
65- expect ( anchorElement ) . toHaveAttribute ( 'data-tooltip-content' )
6661 await waitFor ( ( ) => {
62+ const tooltip = screen . getByRole ( 'tooltip' )
63+ expect ( tooltip ) . toHaveAttribute ( 'style' )
6764 expect ( anchorElement ) . toHaveAttribute ( 'aria-describedby' , 'example-place-attr' )
6865 } )
69- expect ( tooltip ) . toBeInTheDocument ( )
66+
67+ expect ( anchorElement ) . toHaveAttribute ( 'data-tooltip-place' )
68+ expect ( anchorElement ) . toHaveAttribute ( 'data-tooltip-content' )
69+ expect ( screen . getByRole ( 'tooltip' ) ) . toBeInTheDocument ( )
7070 } )
7171
7272 test ( 'tooltip with class name' , async ( ) => {
@@ -81,13 +81,13 @@ describe('tooltip attributes', () => {
8181
8282 await userEvent . hover ( anchorElement )
8383
84- const tooltip = await screen . findByRole ( 'tooltip' )
85- expect ( tooltip ) . toHaveClass ( 'tooltip-class-name' )
86-
87- expect ( anchorElement ) . toHaveAttribute ( 'data-tooltip-class-name' )
8884 await waitFor ( ( ) => {
85+ const tooltip = screen . getByRole ( 'tooltip' )
86+ expect ( tooltip ) . toHaveClass ( 'tooltip-class-name' )
8987 expect ( anchorElement ) . toHaveAttribute ( 'aria-describedby' , 'example-class-name-attr' )
9088 } )
91- expect ( tooltip ) . toBeInTheDocument ( )
89+
90+ expect ( anchorElement ) . toHaveAttribute ( 'data-tooltip-class-name' )
91+ expect ( screen . getByRole ( 'tooltip' ) ) . toBeInTheDocument ( )
9292 } )
9393} )
0 commit comments