Merged in fix/3697-prettier-configs (pull request #3396)
fix(SW-3691): Setup one prettier config for whole repo * Setup prettierrc in root and remove other configs Approved-by: Joakim Jäderberg Approved-by: Linus Flood
This commit is contained in:
@@ -1,30 +1,30 @@
|
||||
import { toast } from './index.tsx'
|
||||
import { Toast } from './Toast.tsx'
|
||||
import { toast } from "./index.tsx"
|
||||
import { Toast } from "./Toast.tsx"
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/nextjs-vite'
|
||||
import type { Meta, StoryObj } from "@storybook/nextjs-vite"
|
||||
|
||||
import { config } from './variants.ts'
|
||||
import { ToastHandler } from './ToastHandler.tsx'
|
||||
import { Button } from '../Button/Button.tsx'
|
||||
import { expect, waitFor } from 'storybook/test'
|
||||
import { config } from "./variants.ts"
|
||||
import { ToastHandler } from "./ToastHandler.tsx"
|
||||
import { Button } from "../Button/Button.tsx"
|
||||
import { expect, waitFor } from "storybook/test"
|
||||
|
||||
const meta: Meta<typeof Toast> = {
|
||||
title: 'Core Components/Toast/ToastHandler',
|
||||
title: "Core Components/Toast/ToastHandler",
|
||||
component: Toast,
|
||||
argTypes: {
|
||||
variant: {
|
||||
control: 'select',
|
||||
type: 'string',
|
||||
control: "select",
|
||||
type: "string",
|
||||
options: Object.keys(config.variants.variant),
|
||||
table: {
|
||||
defaultValue: { summary: 'info' },
|
||||
defaultValue: { summary: "info" },
|
||||
},
|
||||
},
|
||||
message: {
|
||||
control: 'text',
|
||||
type: 'string',
|
||||
control: "text",
|
||||
type: "string",
|
||||
table: {
|
||||
defaultValue: { summary: 'Toast message' },
|
||||
defaultValue: { summary: "Toast message" },
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -36,26 +36,26 @@ type Story = StoryObj<typeof Toast>
|
||||
|
||||
export const Default: Story = {
|
||||
args: {
|
||||
variant: 'info',
|
||||
message: 'This is a toast',
|
||||
variant: "info",
|
||||
message: "This is a toast",
|
||||
},
|
||||
render: (args) => {
|
||||
return <Renderer variant={args.variant} message={args.message as string} />
|
||||
},
|
||||
|
||||
play: async ({ canvas, userEvent, args }) => {
|
||||
let toast = canvas.queryByRole('status')
|
||||
let toast = canvas.queryByRole("status")
|
||||
expect(toast).not.toBeInTheDocument()
|
||||
|
||||
const showToastButton = await canvas.findByRole('button')
|
||||
const showToastButton = await canvas.findByRole("button")
|
||||
await userEvent.click(showToastButton)
|
||||
|
||||
toast = await canvas.findByRole(
|
||||
['info', 'success'].indexOf(args.variant) !== -1 ? 'status' : 'alert'
|
||||
["info", "success"].indexOf(args.variant) !== -1 ? "status" : "alert"
|
||||
)
|
||||
await waitFor(async () => await expect(toast).toBeVisible())
|
||||
|
||||
const closeButton = await canvas.findByLabelText('Dismiss notification')
|
||||
const closeButton = await canvas.findByLabelText("Dismiss notification")
|
||||
await userEvent.click(closeButton)
|
||||
|
||||
await waitFor(async () => await expect(toast).not.toBeVisible())
|
||||
@@ -67,10 +67,10 @@ const Renderer = ({
|
||||
variant,
|
||||
}: {
|
||||
message: string
|
||||
variant: 'info' | 'success' | 'warning' | 'error'
|
||||
variant: "info" | "success" | "warning" | "error"
|
||||
onDismiss?: () => void
|
||||
}) => {
|
||||
const text = 'Show Toast'
|
||||
const text = "Show Toast"
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
|
||||
Reference in New Issue
Block a user