Skip to content

Commit 4d20859

Browse files
feat(Simulator/ClickAnimation): create stories
1 parent cc05646 commit 4d20859

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

src/components/Simulator/ClickAnimation.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export const ClickAnimation = ({
4949
bottom={bottom}
5050
insetInline={0}
5151
color="primary.base"
52+
data-testid="click-animation-el"
5253
>
5354
<MotionFlex
5455
direction={direction}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import type { Meta, StoryObj } from "@storybook/react/*"
2+
import { expect, waitFor, within } from "@storybook/test"
3+
4+
import { Button } from "@/components/ui/buttons/Button"
5+
6+
import { ClickAnimation } from "../ClickAnimation"
7+
8+
const meta = {
9+
title: "Molecules / Display Content / Simulator / ClickAnimation",
10+
component: ClickAnimation,
11+
decorators: [
12+
(Story) => (
13+
<div className="relative">
14+
<Story />
15+
<Button>Visit NFT Market</Button>
16+
</div>
17+
),
18+
],
19+
args: {
20+
children: "Click!",
21+
},
22+
play: async ({ canvasElement }) => {
23+
const canvas = within(canvasElement)
24+
25+
await waitFor(
26+
async () => {
27+
const animationEl = canvas.getByTestId("click-animation-el")
28+
29+
await expect(animationEl).toBeVisible()
30+
await waitFor(
31+
async () => {
32+
await expect(animationEl).toHaveStyle({ transform: "none" })
33+
},
34+
{ timeout: 1500 }
35+
)
36+
},
37+
{ timeout: 6000 }
38+
)
39+
},
40+
} satisfies Meta<typeof ClickAnimation>
41+
42+
export default meta
43+
44+
type Story = StoryObj<typeof meta>
45+
46+
export const Default: Story = {}
47+
48+
export const Below: Story = {
49+
args: {
50+
below: true,
51+
},
52+
}

0 commit comments

Comments
 (0)