This commit is contained in:
Thomas Trompette 2024-12-13 16:31:33 +01:00
parent 0400f6e08e
commit 57f7defef9
2 changed files with 31 additions and 2 deletions

View File

@ -0,0 +1,31 @@
import { Meta, StoryObj } from '@storybook/react';
import { within } from '@storybook/test';
import { FormLinksFieldInput } from '../FormLinksFieldInput';
const meta: Meta<typeof FormLinksFieldInput> = {
title: 'UI/Data/Field/Form/Input/FormLinksFieldInput',
component: FormLinksFieldInput,
args: {},
argTypes: {},
};
export default meta;
type Story = StoryObj<typeof FormLinksFieldInput>;
export const Default: Story = {
args: {
label: 'Domaine Name',
defaultValue: {
primaryLinkLabel: 'Google',
primaryLinkUrl: 'www.google.com',
},
},
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
await canvas.findByText('Domaine Name');
await canvas.findByText('Primary Link Label');
await canvas.findByText('Google');
},
};

View File

@ -35,10 +35,8 @@ export const useLinksField = () => {
const persistLinksField = (nextValue: FieldLinksValue) => {
try {
console.log('persistLinksField', nextValue);
persistField(linksSchema.parse(nextValue));
} catch {
console.error('Failed to persist links field');
return;
}
};