@@ -295,27 +295,27 @@ test('validate warns and skips validation on a disabled field', async () => {
295295 consoleWarnSpy . mockRestore ( ) ;
296296} ) ;
297297
298- describe ( 'isValidated state' , ( ) => {
299- test ( 'field starts with isValidated as false' , async ( ) => {
300- const { isValidated } = renderSetup ( ( ) => {
298+ describe ( 'isUserValidated state' , ( ) => {
299+ test ( 'field starts with isUserValidated as false' , async ( ) => {
300+ const { isUserValidated } = renderSetup ( ( ) => {
301301 return useFormField ( { label : 'Field' , initialValue : 'bar' } ) . state ;
302302 } ) ;
303303
304- expect ( isValidated . value ) . toBe ( false ) ;
304+ expect ( isUserValidated . value ) . toBe ( false ) ;
305305 } ) ;
306306
307- test ( 'isValidated remains false after programmatic validation without schema' , async ( ) => {
308- const { isValidated , validate } = renderSetup ( ( ) => {
307+ test ( 'isUserValidated remains false after programmatic validation without schema' , async ( ) => {
308+ const { isUserValidated , validate } = renderSetup ( ( ) => {
309309 return useFormField ( { label : 'Field' , initialValue : 'bar' } ) . state ;
310310 } ) ;
311311
312- expect ( isValidated . value ) . toBe ( false ) ;
312+ expect ( isUserValidated . value ) . toBe ( false ) ;
313313 await validate ( ) ;
314- expect ( isValidated . value ) . toBe ( false ) ; // Should remain false - programmatic validation
314+ expect ( isUserValidated . value ) . toBe ( false ) ; // Should remain false - programmatic validation
315315 } ) ;
316316
317- test ( 'isValidated remains false after programmatic validation with schema' , async ( ) => {
318- const { isValidated , validate } = renderSetup ( ( ) => {
317+ test ( 'isUserValidated remains false after programmatic validation with schema' , async ( ) => {
318+ const { isUserValidated , validate } = renderSetup ( ( ) => {
319319 return useFormField ( {
320320 label : 'Field' ,
321321 initialValue : 'bar' ,
@@ -325,13 +325,13 @@ describe('isValidated state', () => {
325325 } ) . state ;
326326 } ) ;
327327
328- expect ( isValidated . value ) . toBe ( false ) ;
328+ expect ( isUserValidated . value ) . toBe ( false ) ;
329329 await validate ( ) ;
330- expect ( isValidated . value ) . toBe ( false ) ; // Should remain false - programmatic validation
330+ expect ( isUserValidated . value ) . toBe ( false ) ; // Should remain false - programmatic validation
331331 } ) ;
332332
333- test ( 'isValidated remains false after programmatic validation with errors' , async ( ) => {
334- const { isValidated , validate } = renderSetup ( ( ) => {
333+ test ( 'isUserValidated remains false after programmatic validation with errors' , async ( ) => {
334+ const { isUserValidated , validate } = renderSetup ( ( ) => {
335335 return useFormField ( {
336336 label : 'Field' ,
337337 initialValue : '' ,
@@ -341,24 +341,24 @@ describe('isValidated state', () => {
341341 } ) . state ;
342342 } ) ;
343343
344- expect ( isValidated . value ) . toBe ( false ) ;
344+ expect ( isUserValidated . value ) . toBe ( false ) ;
345345 await validate ( true ) ;
346- expect ( isValidated . value ) . toBe ( false ) ; // Should remain false - programmatic validation
346+ expect ( isUserValidated . value ) . toBe ( false ) ; // Should remain false - programmatic validation
347347 } ) ;
348348
349- test ( 'isValidated can be set manually' , async ( ) => {
350- const { isValidated , setIsValidated } = renderSetup ( ( ) => {
349+ test ( 'isUserValidated can be set manually' , async ( ) => {
350+ const { isUserValidated , setIsUserValidated } = renderSetup ( ( ) => {
351351 return useFormField ( { label : 'Field' , initialValue : 'bar' } ) . state ;
352352 } ) ;
353353
354- expect ( isValidated . value ) . toBe ( false ) ;
355- setIsValidated ( true ) ;
356- expect ( isValidated . value ) . toBe ( true ) ;
357- setIsValidated ( false ) ;
358- expect ( isValidated . value ) . toBe ( false ) ;
354+ expect ( isUserValidated . value ) . toBe ( false ) ;
355+ setIsUserValidated ( true ) ;
356+ expect ( isUserValidated . value ) . toBe ( true ) ;
357+ setIsUserValidated ( false ) ;
358+ expect ( isUserValidated . value ) . toBe ( false ) ;
359359 } ) ;
360360
361- test ( 'isValidated becomes true after form submit attempt' , async ( ) => {
361+ test ( 'isUserValidated becomes true after form submit attempt' , async ( ) => {
362362 const { form, field } = renderSetup (
363363 ( ) => {
364364 const form = useForm ( {
@@ -380,32 +380,32 @@ describe('isValidated state', () => {
380380 } ,
381381 ) ;
382382
383- expect ( field . state . isValidated . value ) . toBe ( false ) ;
383+ expect ( field . state . isUserValidated . value ) . toBe ( false ) ;
384384
385385 // Submit attempt is a user interaction
386386 const handleSubmit = form . handleSubmit ( async ( ) => { } ) ;
387387 await handleSubmit ( ) ;
388388
389- expect ( field . state . isValidated . value ) . toBe ( true ) ;
389+ expect ( field . state . isUserValidated . value ) . toBe ( true ) ;
390390 } ) ;
391391
392- test ( 'isValidated is independent for pathless fields' , async ( ) => {
392+ test ( 'isUserValidated is independent for pathless fields' , async ( ) => {
393393 const { field1, field2 } = renderSetup ( ( ) => {
394394 const field1 = useFormField ( { label : 'Field1' , initialValue : 'bar' } ) ;
395395 const field2 = useFormField ( { label : 'Field2' , initialValue : 'baz' } ) ;
396396 return { field1, field2 } ;
397397 } ) ;
398398
399- expect ( field1 . state . isValidated . value ) . toBe ( false ) ;
400- expect ( field2 . state . isValidated . value ) . toBe ( false ) ;
399+ expect ( field1 . state . isUserValidated . value ) . toBe ( false ) ;
400+ expect ( field2 . state . isUserValidated . value ) . toBe ( false ) ;
401401
402- // Manually set isValidated (simulating user interaction)
403- field1 . state . setIsValidated ( true ) ;
404- expect ( field1 . state . isValidated . value ) . toBe ( true ) ;
405- expect ( field2 . state . isValidated . value ) . toBe ( false ) ;
402+ // Manually set isUserValidated (simulating user interaction)
403+ field1 . state . setIsUserValidated ( true ) ;
404+ expect ( field1 . state . isUserValidated . value ) . toBe ( true ) ;
405+ expect ( field2 . state . isUserValidated . value ) . toBe ( false ) ;
406406
407- field2 . state . setIsValidated ( true ) ;
408- expect ( field1 . state . isValidated . value ) . toBe ( true ) ;
409- expect ( field2 . state . isValidated . value ) . toBe ( true ) ;
407+ field2 . state . setIsUserValidated ( true ) ;
408+ expect ( field1 . state . isUserValidated . value ) . toBe ( true ) ;
409+ expect ( field2 . state . isUserValidated . value ) . toBe ( true ) ;
410410 } ) ;
411411} ) ;
0 commit comments