Skip to content

Commit f2ad5e2

Browse files
feat(Simulator/screens/Slider): create stories
1 parent a10d5cd commit f2ad5e2

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

src/components/Simulator/screens/ConnectWeb3/Slider.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export const Slider = ({ isConnected, displayUrl, children }: SliderProps) => {
3131
animate={{ bottom: 0 }}
3232
exit={{ bottom: "-100%" }}
3333
transition={{ duration: 0.75, ease: "easeOut" }}
34+
data-testid="slider-box"
3435
>
3536
<Flex
3637
direction="column"
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import type { Meta, StoryObj } from "@storybook/react"
2+
import { expect, fireEvent, waitFor, within } from "@storybook/test"
3+
4+
import { Slider as SliderComponent } from "../Slider"
5+
6+
const meta = {
7+
title:
8+
"Molecules / Display Content / Simulator / ConnectWeb3 Screen / Slider",
9+
component: SliderComponent,
10+
decorators: [
11+
(Story) => (
12+
<div className="relative h-[500px] w-[322px]">
13+
<Story />
14+
</div>
15+
),
16+
],
17+
args: {
18+
displayUrl: "https://metamask.io/",
19+
children:
20+
"Connecting to the website will not share any personal or secure information with the site owners.",
21+
},
22+
play: async ({ canvasElement }) => {
23+
const canvas = within(canvasElement)
24+
25+
const slider = canvas.getByTestId("slider-box")
26+
27+
await fireEvent.animationEnd(slider)
28+
29+
await waitFor(async () => {
30+
await expect(slider).toHaveStyle({ bottom: "0px" })
31+
})
32+
},
33+
} satisfies Meta<typeof SliderComponent>
34+
35+
export default meta
36+
37+
export const NotConnected: StoryObj<typeof meta> = {
38+
args: {
39+
isConnected: false,
40+
},
41+
}
42+
43+
export const Connected: StoryObj<typeof meta> = {
44+
args: {
45+
isConnected: true,
46+
},
47+
}

0 commit comments

Comments
 (0)