Download react-hook-form/src/__tests__/logic/getValidationModes.test.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.37 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-hook-form/src/__tests__/logic/getValidationModes.test.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-hook-form/src/__tests__/logic/getValidationModes.test.ts
-
curl -L -o getValidationModes.test.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-hook-form/src/__tests__/logic/getValidationModes.test.ts
1.37 kB
| import { VALIDATION_MODE } from '../../constants'; | |
| import getValidationModes from '../../logic/getValidationModes'; | |
| describe('getValidationModes', () => { | |
| it('shold return correct flags for each mode', () => { | |
| expect(getValidationModes(VALIDATION_MODE.onBlur)).toEqual({ | |
| isOnSubmit: false, | |
| isOnBlur: true, | |
| isOnChange: false, | |
| isOnAll: false, | |
| isOnTouch: false, | |
| }); | |
| expect(getValidationModes(VALIDATION_MODE.onChange)).toEqual({ | |
| isOnSubmit: false, | |
| isOnBlur: false, | |
| isOnChange: true, | |
| isOnAll: false, | |
| isOnTouch: false, | |
| }); | |
| expect(getValidationModes(VALIDATION_MODE.onSubmit)).toEqual({ | |
| isOnSubmit: true, | |
| isOnBlur: false, | |
| isOnChange: false, | |
| isOnAll: false, | |
| isOnTouch: false, | |
| }); | |
| expect(getValidationModes(undefined)).toEqual({ | |
| isOnSubmit: true, | |
| isOnBlur: false, | |
| isOnChange: false, | |
| isOnAll: false, | |
| isOnTouch: false, | |
| }); | |
| expect(getValidationModes(VALIDATION_MODE.all)).toEqual({ | |
| isOnSubmit: false, | |
| isOnBlur: false, | |
| isOnChange: false, | |
| isOnAll: true, | |
| isOnTouch: false, | |
| }); | |
| expect(getValidationModes(VALIDATION_MODE.onTouched)).toEqual({ | |
| isOnSubmit: false, | |
| isOnBlur: false, | |
| isOnChange: false, | |
| isOnAll: false, | |
| isOnTouch: true, | |
| }); | |
| }); | |
| }); | |