()
| 38 | .required(); |
| 39 | |
| 40 | const BasicSchemaValidation: React.FC = () => { |
| 41 | const { mode } = useParams(); |
| 42 | const { |
| 43 | register, |
| 44 | handleSubmit, |
| 45 | formState: { errors }, |
| 46 | } = useForm<{ |
| 47 | firstName: string; |
| 48 | lastName: string; |
| 49 | min: string; |
| 50 | max: string; |
| 51 | minDate: string; |
| 52 | maxDate: string; |
| 53 | minLength: string; |
| 54 | minRequiredLength: string; |
| 55 | selectNumber: string; |
| 56 | pattern: string; |
| 57 | radio: string; |
| 58 | checkbox: string; |
| 59 | multiple: string; |
| 60 | validate: string; |
| 61 | }>({ |
| 62 | resolver: yupResolver(validationSchema), |
| 63 | mode: mode as keyof ValidationMode, |
| 64 | }); |
| 65 | const onSubmit = () => {}; |
| 66 | |
| 67 | renderCounter++; |
| 68 | |
| 69 | return ( |
| 70 | <form onSubmit={handleSubmit(onSubmit)}> |
| 71 | <input {...register('firstName')} placeholder="firstName" /> |
| 72 | {errors.firstName && <p>firstName error</p>} |
| 73 | <input {...register('lastName')} placeholder="lastName" /> |
| 74 | {errors.lastName && <p>lastName error</p>} |
| 75 | <input type="number" {...register('min')} placeholder="min" /> |
| 76 | {errors.min && <p>min error</p>} |
| 77 | <input type="number" {...register('max')} placeholder="max" /> |
| 78 | {errors.max && <p>max error</p>} |
| 79 | <input type="date" {...register('minDate')} placeholder="minDate" /> |
| 80 | {errors.minDate && <p>minDate error</p>} |
| 81 | <input type="date" {...register('maxDate')} placeholder="maxDate" /> |
| 82 | {errors.maxDate && <p>maxDate error</p>} |
| 83 | <input {...register('minLength')} placeholder="minLength" /> |
| 84 | {errors.minLength && <p>minLength error</p>} |
| 85 | <input |
| 86 | {...register('minRequiredLength')} |
| 87 | placeholder="minRequiredLength" |
| 88 | /> |
| 89 | {errors.minRequiredLength && <p>minRequiredLength error</p>} |
| 90 | <select {...register('selectNumber')}> |
| 91 | <option value="">Select</option> |
| 92 | <option value={1}>1</option> |
| 93 | <option value={2}>1</option> |
| 94 | </select> |
| 95 | {errors.selectNumber && <p>selectNumber error</p>} |
| 96 | <input {...register('pattern')} placeholder="pattern" /> |
| 97 | {errors.pattern && <p>pattern error</p>} |
nothing calls this directly
no test coverage detected