import { userEvent, within } from 'storybook/test'; import { Meta, StoryObj } from '@storybook/react-webpack5'; import { useRtlDiffI18n, withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator'; import InputWithDisplayFormat, { InputWithDisplayFormatProps } from '..'; import Field, { FieldProps } from '../../Field/Field'; const meta: Meta = { title: 'Forms/InputWithDisplayFormat/Tests', component: InputWithDisplayFormat, tags: ['!autodocs', '!manifest'], render: function Render({ label, ...args }: InputWithDisplayFormatProps & FieldProps) { return ( ); }, }; export default meta; type Story = StoryObj; export const SecurityPinPlay: Story = { args: { label: 'Security Pin Play', placeholder: '*-*-*-*-*-*', displayPattern: '*-*-*-*-*-*', }, play: async ({ canvasElement }) => { const canvas = within(canvasElement); await userEvent.type(canvas.getByPlaceholderText('*-*-*-*-*-*'), '123456'); }, }; export const RTLDiff: StoryObj = { render: () => { const i18n = useRtlDiffI18n(); return ( <> {}} /> {}} /> {}} /> ); }, ...withRTLDiff({ fixedRows: { heights: 'auto' }, width: 'stretch', i18n: { value: { en: 'XKQMRTBWJNFL', ar: 'خكقمرتبوجنفل', }, placeholder: { en: 'Enter code', ar: 'أدخل الرمز', }, }, }), };