-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: enhance Button component with tone and variant options
- Loading branch information
Showing
3 changed files
with
64 additions
and
99 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,14 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import { expect, fn, userEvent } from "@storybook/test"; | ||
import { Button } from "./Button"; | ||
|
||
const meta = { | ||
export default { | ||
component: Button, | ||
parameters: { | ||
layout: "centered", | ||
}, | ||
args: { onClick: fn() }, | ||
} satisfies Meta<typeof Button>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Basic: Story = { | ||
args: { | ||
type: "button", | ||
children: "시작하기", | ||
}, | ||
play: async ({ args: { onClick }, canvas, step }) => { | ||
const button = canvas.getByRole("button"); | ||
|
||
await step("renders a button with text", async () => { | ||
expect(button).toHaveTextContent("시작하기"); | ||
}); | ||
|
||
await step("calls onClick handler when clicked", async () => { | ||
await userEvent.click(button); | ||
expect(onClick).toHaveBeenCalledTimes(1); | ||
}); | ||
}, | ||
}; | ||
} satisfies Meta<typeof Button>; | ||
|
||
// export const Submit: Story = { | ||
// args: { | ||
// type: "submit", | ||
// children: "Submit", | ||
// }, | ||
// }; | ||
export const Basic: StoryObj<typeof Button> = {}; |
This file contains 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
This file contains 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