Last active
January 21, 2022 12:54
-
-
Save tidusia/74e25bc3c3bb0277248b25bc5f779f4b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ComponentMeta } from "@storybook/react"; | |
import COMPONENT_NAME from "."; | |
import { userEvent, within } from "@storybook/testing-library"; | |
export default { | |
component: COMPONENT_NAME, | |
decorators: [(story) => <div>{story()}</div>], | |
parameters: { | |
layout: "centered", | |
}, | |
} as ComponentMeta<typeof COMPONENT_NAME>; | |
export const Default: ComponentStoryObj<typeof COMPONENT_NAME> = { | |
args: { | |
content: "Some content", | |
}, | |
}; | |
export const Clicked: ComponentStoryObj<typeof COMPONENT_NAME> = { | |
args: { ...Default.args }, | |
play: async ({ canvasElement }: any) => { | |
const canvas = within(canvasElement); | |
await userEvent.click(canvas.getByText("Some content")); | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment