Skip to content

Commit d0bcf4d

Browse files
filiptammergardloodde
authored andcommitted
chore: wait for exit animation to complete
1 parent d071be0 commit d0bcf4d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/components/views/Sheets/Sheets.stories.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useDisclosure } from "@einride/hooks"
22
import { Meta, StoryObj } from "@storybook/react"
3-
import { expect, userEvent, within } from "@storybook/test"
3+
import { expect, userEvent, waitFor, within } from "@storybook/test"
44
import { IconButton } from "../../controls/buttons/IconButton/IconButton"
55
import { PrimaryButton } from "../../controls/buttons/PrimaryButton/PrimaryButton"
66
import { Menu } from "../../menus/Menu/Menu"
@@ -73,7 +73,9 @@ export const Pointer = {
7373
await expect(openButton).toHaveStyle("pointer-events: none")
7474
const closeButton = canvas.getByRole("button", { name: "Close" })
7575
await userEvent.click(closeButton)
76-
await expect(dialog).not.toBeInTheDocument()
76+
await waitFor(async () => {
77+
await expect(dialog).not.toBeInTheDocument()
78+
})
7779
},
7880
} satisfies StoryObj
7981

@@ -91,7 +93,9 @@ export const Keyboard = {
9193
const closeButton = canvas.getByRole("button", { name: "Close" })
9294
await expect(closeButton).toHaveFocus()
9395
await userEvent.keyboard("[Enter]")
94-
await expect(dialog).not.toBeInTheDocument()
96+
await waitFor(async () => {
97+
await expect(dialog).not.toBeInTheDocument()
98+
})
9599
},
96100
} satisfies StoryObj
97101

0 commit comments

Comments
 (0)