docs: use ComponentDecorator (#800)

Related to #702
This commit is contained in:
Thaïs
2023-07-21 21:02:21 +02:00
committed by GitHub
parent 79fccb0404
commit 56cff63c4b
36 changed files with 777 additions and 910 deletions

View File

@ -3,13 +3,21 @@ import { expect, jest } from '@storybook/jest';
import type { Meta, StoryObj } from '@storybook/react';
import { userEvent, within } from '@storybook/testing-library';
import { getRenderWrapperForComponent } from '~/testing/renderWrappers';
import { ComponentDecorator } from '~/testing/decorators';
import { PrimaryLink } from '../PrimaryLink';
const meta: Meta<typeof PrimaryLink> = {
title: 'UI/Links/PrimaryLink',
component: PrimaryLink,
decorators: [
(Story) => (
<MemoryRouter>
<Story />
</MemoryRouter>
),
ComponentDecorator,
],
};
export default meta;
@ -18,13 +26,7 @@ type Story = StoryObj<typeof PrimaryLink>;
const clickJestFn = jest.fn();
export const Default: Story = {
render: getRenderWrapperForComponent(
<MemoryRouter>
<PrimaryLink href="/test" onClick={clickJestFn}>
A primary link
</PrimaryLink>
</MemoryRouter>,
),
args: { href: '/test', onClick: clickJestFn, children: 'A primary link' },
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);