Skip to content

Commit 5bada51

Browse files
fix(tooltip.stories): revert to isOpen arg for OnOpen story, add large decoorator
1 parent 0e0abf1 commit 5bada51

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

src/components/Tooltip/Tooltip.stories.tsx

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from "react"
22
import { RiInformationLine } from "react-icons/ri"
3-
import { Box } from "@chakra-ui/react"
3+
import { Box, Center } from "@chakra-ui/react"
44
import { Meta, StoryObj } from "@storybook/react"
55
import { expect, userEvent, waitFor, within } from "@storybook/test"
66

@@ -49,9 +49,9 @@ const meta = {
4949
},
5050
decorators: [
5151
(Story) => (
52-
<div>
52+
<Center boxSize="md">
5353
<Story />
54-
</div>
54+
</Center>
5555
),
5656
],
5757
} satisfies Meta<TooltipType>
@@ -64,16 +64,7 @@ export const Basic: Story = {}
6464

6565
// for chromatic story snapshot showing the rendered popover
6666
export const OnOpen: Story = {
67-
play: async ({ canvasElement }) => {
68-
// Add delay for snapshot capture of the popover
69-
const canvas = within(canvasElement)
70-
const canvasParent = within(canvasElement.parentElement!)
71-
72-
const tooltipIcon = canvas.getByTestId("tooltip-icon")
73-
74-
await waitFor(async () => {
75-
await userEvent.hover(tooltipIcon)
76-
await expect(canvasParent.getByTestId("tooltip-popover")).toBeVisible()
77-
})
67+
args: {
68+
isOpen: true,
7869
},
7970
}

0 commit comments

Comments
 (0)