mirror of
https://github.com/twentyhq/twenty.git
synced 2025-01-03 09:42:01 +03:00
Add test
This commit is contained in:
parent
0400f6e08e
commit
57f7defef9
@ -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');
|
||||
},
|
||||
};
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user