-
Notifications
You must be signed in to change notification settings - Fork 305
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Hiroshiba Kazuyuki <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Hiroshiba <[email protected]>
- Loading branch information
1 parent
5a81c98
commit 5708236
Showing
20 changed files
with
172 additions
and
4 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { ref } from "vue"; | ||
import type { Meta, StoryObj } from "@storybook/vue3"; | ||
|
||
import BaseSelect from "./BaseSelect.vue"; | ||
import BaseSelectItem from "./BaseSelectItem.vue"; | ||
|
||
const meta: Meta<typeof BaseSelect> = { | ||
component: BaseSelect, | ||
render: (args) => ({ | ||
components: { BaseSelect, BaseSelectItem }, | ||
setup() { | ||
const modelValue = ref( | ||
args.modelValue ? String(args.modelValue) : undefined, | ||
); | ||
return { args, modelValue }; | ||
}, | ||
template: ` | ||
<BaseSelect v-bind="args" v-model="modelValue"> | ||
<BaseSelectItem label="A" value="a" /> | ||
<BaseSelectItem label="B" value="b" /> | ||
<BaseSelectItem label="C" value="c" /> | ||
</BaseSelect>`, | ||
}), | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof BaseSelect>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
modelValue: "a", | ||
}, | ||
}; | ||
|
||
export const Placeholder: Story = { | ||
args: { | ||
placeholder: "placeholder", | ||
}, | ||
}; | ||
|
||
export const Disabled: Story = { | ||
args: { | ||
modelValue: "a", | ||
disabled: true, | ||
}, | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import type { Meta, StoryObj } from "@storybook/vue3"; | ||
|
||
import { TooltipProvider } from "radix-vue"; | ||
import BaseTooltip from "./BaseTooltip.vue"; | ||
|
||
const meta: Meta<typeof BaseTooltip> = { | ||
component: BaseTooltip, | ||
render: (args) => ({ | ||
components: { BaseTooltip, TooltipProvider }, | ||
setup() { | ||
return { args }; | ||
}, | ||
template: ` | ||
<TooltipProvider> | ||
<BaseTooltip v-bind="args"> | ||
<span>Hover</span> | ||
</BaseTooltip> | ||
</TooltipProvider>`, | ||
}), | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof BaseTooltip>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
label: "Default", | ||
}, | ||
}; | ||
|
||
export const Disabled: Story = { | ||
args: { | ||
label: "Default", | ||
disabled: true, | ||
}, | ||
}; |
65 changes: 65 additions & 0 deletions
65
src/components/Dialog/AcceptDialog/AcceptDialog.stories.ts
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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { userEvent, within, expect, fn } from "@storybook/test"; | ||
|
||
import { Meta, StoryObj } from "@storybook/vue3"; | ||
import AcceptDialog from "./AcceptDialog.vue"; | ||
|
||
const meta: Meta<typeof AcceptDialog> = { | ||
component: AcceptDialog, | ||
args: { | ||
modelValue: false, | ||
title: "タイトル", | ||
heading: "見出し", | ||
terms: "# 見出し1\n文章文章文章\n## 見出し2\n文章文章文章", | ||
rejectLabel: "拒否", | ||
acceptLabel: "承諾", | ||
"onUpdate:modelValue": fn(), | ||
onAccept: fn(), | ||
onReject: fn(), | ||
}, | ||
tags: ["!autodocs"], // ダイアログ系はautodocsのプレビューが正しく表示されないので無効化 | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Opened: Story = { | ||
name: "開いている", | ||
args: { | ||
modelValue: true, | ||
}, | ||
}; | ||
|
||
export const Accept: Story = { | ||
name: "承諾ボタンを押す", | ||
args: { ...Opened.args }, | ||
play: async ({ args }) => { | ||
const canvas = within(document.body); // ダイアログなので例外的にdocument.bodyを使う | ||
|
||
const button = canvas.getByRole("button", { name: /承諾/ }); | ||
await userEvent.click(button); | ||
|
||
// 承諾イベントが呼ばれる | ||
await expect(args["onAccept"]).toBeCalledWith(); | ||
}, | ||
}; | ||
|
||
export const Reject: Story = { | ||
name: "拒否ボタンを押す", | ||
args: { | ||
...Opened.args, | ||
}, | ||
play: async ({ args }) => { | ||
const canvas = within(document.body); // ダイアログなので例外的にdocument.bodyを使う | ||
|
||
const button = canvas.getByRole("button", { name: /拒否/ }); | ||
await userEvent.click(button); | ||
|
||
// 拒否イベントが呼ばれる | ||
await expect(args["onReject"]).toBeCalledWith(); | ||
}, | ||
}; | ||
|
||
export const Closed: Story = { | ||
name: "閉じている", | ||
tags: ["skip-screenshot"], | ||
}; |
Binary file added
BIN
+1.77 KB
....mts-snapshots/components-base-basecheckbox--unchecked-dark-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.62 KB
...mts-snapshots/components-base-basecheckbox--unchecked-light-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.16 KB
...spec.mts-snapshots/components-base-baseselect--default-dark-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.13 KB
...pec.mts-snapshots/components-base-baseselect--default-light-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.12 KB
...pec.mts-snapshots/components-base-baseselect--disabled-dark-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.1 KB
...ec.mts-snapshots/components-base-baseselect--disabled-light-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.15 KB
....mts-snapshots/components-base-baseselect--placeholder-dark-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.89 KB
...mts-snapshots/components-base-baseselect--placeholder-light-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+915 Bytes
...pec.mts-snapshots/components-base-basetooltip--default-dark-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+813 Bytes
...ec.mts-snapshots/components-base-basetooltip--default-light-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+915 Bytes
...ec.mts-snapshots/components-base-basetooltip--disabled-dark-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+813 Bytes
...c.mts-snapshots/components-base-basetooltip--disabled-light-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+14.1 KB
...c.mts-snapshots/components-dialog-acceptdialog--opened-dark-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+13.9 KB
....mts-snapshots/components-dialog-acceptdialog--opened-light-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.