-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: added story for add-payment-method form
- Loading branch information
Showing
2 changed files
with
41 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import type { Meta, StoryObj } from "@storybook/vue3"; | ||
|
||
import AddPaymentMethod from "@/forms/AddPaymentMethod.vue"; | ||
import { useUserStore } from "@/stores/user"; | ||
|
||
import userFixture from "../../cypress/fixtures/user.json"; | ||
|
||
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories | ||
const meta: Meta<typeof AddPaymentMethod> = { | ||
title: "Forms/AddPaymentMethod", | ||
component: AddPaymentMethod, | ||
// This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/writing-docs/autodocs | ||
tags: ["autodocs"], | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof AddPaymentMethod>; | ||
/* | ||
*👇 Render functions are a framework specific feature to allow you control on how the component renders. | ||
* See https://storybook.js.org/docs/api/csf | ||
* to learn how to use render functions. | ||
*/ | ||
export const Default: Story = { | ||
render: (args) => ({ | ||
components: { AddPaymentMethod }, | ||
setup() { | ||
const user = useUserStore(); | ||
user.isAuthenticated = true; | ||
user.user = { | ||
...userFixture, | ||
seen_at: new Date(), | ||
created_at: new Date(), | ||
updated_at: new Date(), | ||
}; | ||
return { args }; | ||
}, | ||
template: | ||
"<AddPaymentMethod v-bind='args'><input type='email' name='email' required placeholder='Email' /><input type='password' name='password' required placeholder='Password' /></AddPaymentMethod>", | ||
}), | ||
}; |