Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thomtrp committed Jan 2, 2025
1 parent 2882e0f commit 6ea4c2d
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Meta, StoryObj } from '@storybook/react';
import { within } from '@storybook/test';

import { FormCountryCodeSelectInput } from '../FormCountryCodeSelectInput';

const meta: Meta<typeof FormCountryCodeSelectInput> = {
title: 'UI/Data/Field/Form/Input/FormCountryCodeSelectInput',
component: FormCountryCodeSelectInput,
args: {},
argTypes: {},
};

export default meta;

type Story = StoryObj<typeof FormCountryCodeSelectInput>;

export const Default: Story = {
args: {
selectedCountryCode: 'FR',
},
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);

await canvas.findByText('Country Code');
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Meta, StoryObj } from '@storybook/react';
import { within } from '@storybook/test';

import { FieldPhonesValue } from '@/object-record/record-field/types/FieldMetadata';
import { FormPhoneFieldInput } from '../FormPhoneFieldInput';

const meta: Meta<typeof FormPhoneFieldInput> = {
title: 'UI/Data/Field/Form/Input/FormPhoneFieldInput',
component: FormPhoneFieldInput,
args: {},
argTypes: {},
};

export default meta;

type Story = StoryObj<typeof FormPhoneFieldInput>;

const defaultPhoneValue: FieldPhonesValue = {
primaryPhoneNumber: '0612345678',
primaryPhoneCountryCode: 'FR',
primaryPhoneCallingCode: '33',
};

export const Default: Story = {
args: {
label: 'Phone',
defaultValue: defaultPhoneValue,
},
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);

await canvas.findByText('Phone');
},
};

0 comments on commit 6ea4c2d

Please sign in to comment.