@@ -2487,6 +2487,60 @@ describe('SSR hydration', () => {
24872487 expect ( `Hydration attribute mismatch` ) . not . toHaveBeenWarned ( )
24882488 } )
24892489
2490+ test ( 'hidden enumerated attribute' , ( ) => {
2491+ mountWithHydration ( `<div></div>` , ( ) => h ( 'div' , { hidden : false } ) )
2492+ expect ( `Hydration attribute mismatch` ) . not . toHaveBeenWarned ( )
2493+
2494+ mountWithHydration ( `<div hidden></div>` , ( ) => h ( 'div' , { hidden : true } ) )
2495+ expect ( `Hydration attribute mismatch` ) . not . toHaveBeenWarned ( )
2496+
2497+ mountWithHydration ( `<div hidden></div>` , ( ) =>
2498+ h ( 'div' , { hidden : 'hidden' } ) ,
2499+ )
2500+ expect ( `Hydration attribute mismatch` ) . not . toHaveBeenWarned ( )
2501+
2502+ mountWithHydration ( `<div hidden="anything"></div>` , ( ) =>
2503+ h ( 'div' , { hidden : true } ) ,
2504+ )
2505+ expect ( `Hydration attribute mismatch` ) . not . toHaveBeenWarned ( )
2506+
2507+ mountWithHydration ( `<div hidden="until-found"></div>` , ( ) =>
2508+ h ( 'div' , { hidden : 'until-found' } ) ,
2509+ )
2510+ expect ( `Hydration attribute mismatch` ) . not . toHaveBeenWarned ( )
2511+
2512+ mountWithHydration ( `<div hidden="UNTIL-FOUND"></div>` , ( ) =>
2513+ h ( 'div' , { hidden : 'until-found' } ) ,
2514+ )
2515+ expect ( `Hydration attribute mismatch` ) . not . toHaveBeenWarned ( )
2516+ } )
2517+
2518+ test ( 'hidden numeric values' , ( ) => {
2519+ mountWithHydration ( `<div></div>` , ( ) => h ( 'div' , { hidden : 0 } ) )
2520+ expect ( `Hydration attribute mismatch` ) . not . toHaveBeenWarned ( )
2521+
2522+ mountWithHydration ( `<div></div>` , ( ) => h ( 'div' , { hidden : NaN } ) )
2523+ expect ( `Hydration attribute mismatch` ) . not . toHaveBeenWarned ( )
2524+
2525+ mountWithHydration ( `<div hidden></div>` , ( ) => h ( 'div' , { hidden : 1 } ) )
2526+ expect ( `Hydration attribute mismatch` ) . not . toHaveBeenWarned ( )
2527+
2528+ mountWithHydration ( `<div hidden="0"></div>` , ( ) =>
2529+ h ( 'div' , { hidden : '0' } ) ,
2530+ )
2531+ expect ( `Hydration attribute mismatch` ) . not . toHaveBeenWarned ( )
2532+ } )
2533+
2534+ test ( 'hidden state mismatch' , ( ) => {
2535+ mountWithHydration ( `<div hidden="until-found"></div>` , ( ) =>
2536+ h ( 'div' , { hidden : true } ) ,
2537+ )
2538+ expect ( `Hydration attribute mismatch` ) . toHaveBeenWarnedTimes ( 1 )
2539+
2540+ mountWithHydration ( `<div hidden></div>` , ( ) => h ( 'div' , { hidden : 0 } ) )
2541+ expect ( `Hydration attribute mismatch` ) . toHaveBeenWarnedTimes ( 2 )
2542+ } )
2543+
24902544 test ( 'client value is null or undefined' , ( ) => {
24912545 mountWithHydration ( `<div></div>` , ( ) =>
24922546 h ( 'div' , { draggable : undefined } ) ,
0 commit comments