1
1
import { useDisclosure } from "@einride/hooks"
2
2
import { Meta , StoryObj } from "@storybook/react"
3
- import { expect , userEvent , within } from "@storybook/test"
3
+ import { expect , userEvent , waitFor , within } from "@storybook/test"
4
4
import { IconButton } from "../../controls/buttons/IconButton/IconButton"
5
5
import { PrimaryButton } from "../../controls/buttons/PrimaryButton/PrimaryButton"
6
6
import { Menu } from "../../menus/Menu/Menu"
@@ -73,7 +73,9 @@ export const Pointer = {
73
73
await expect ( openButton ) . toHaveStyle ( "pointer-events: none" )
74
74
const closeButton = canvas . getByRole ( "button" , { name : "Close" } )
75
75
await userEvent . click ( closeButton )
76
- await expect ( dialog ) . not . toBeInTheDocument ( )
76
+ await waitFor ( async ( ) => {
77
+ await expect ( dialog ) . not . toBeInTheDocument ( )
78
+ } )
77
79
} ,
78
80
} satisfies StoryObj
79
81
@@ -91,7 +93,9 @@ export const Keyboard = {
91
93
const closeButton = canvas . getByRole ( "button" , { name : "Close" } )
92
94
await expect ( closeButton ) . toHaveFocus ( )
93
95
await userEvent . keyboard ( "[Enter]" )
94
- await expect ( dialog ) . not . toBeInTheDocument ( )
96
+ await waitFor ( async ( ) => {
97
+ await expect ( dialog ) . not . toBeInTheDocument ( )
98
+ } )
95
99
} ,
96
100
} satisfies StoryObj
97
101
0 commit comments