@@ -1080,13 +1080,11 @@ describe('SSR hydration', () => {
10801080 } )
10811081
10821082 test ( 'force hydrate prop with `.prop` modifier' , ( ) => {
1083- const { container } = mountWithHydration (
1084- '<input type="checkbox" :indeterminate.prop="true">' ,
1085- ( ) =>
1086- h ( 'input' , {
1087- type : 'checkbox' ,
1088- '.indeterminate' : true ,
1089- } ) ,
1083+ const { container } = mountWithHydration ( '<input type="checkbox">' , ( ) =>
1084+ h ( 'input' , {
1085+ type : 'checkbox' ,
1086+ '.indeterminate' : true ,
1087+ } ) ,
10901088 )
10911089 expect ( ( container . firstChild ! as any ) . indeterminate ) . toBe ( true )
10921090 } )
@@ -1475,6 +1473,16 @@ describe('SSR hydration', () => {
14751473 mountWithHydration ( `<select multiple></div>` , ( ) =>
14761474 h ( 'select' , { multiple : 'multiple' } ) ,
14771475 )
1476+ expect ( `Hydration attribute mismatch` ) . not . toHaveBeenWarned ( )
1477+
1478+ mountWithHydration ( `<div></div>` , ( ) => h ( 'div' , { id : 'foo' } ) )
1479+ expect ( `Hydration attribute mismatch` ) . toHaveBeenWarnedTimes ( 1 )
1480+
1481+ mountWithHydration ( `<div id="bar"></div>` , ( ) => h ( 'div' , { id : 'foo' } ) )
1482+ expect ( `Hydration attribute mismatch` ) . toHaveBeenWarnedTimes ( 2 )
1483+ } )
1484+
1485+ test ( 'attr special case: textarea value' , ( ) => {
14781486 mountWithHydration ( `<textarea>foo</textarea>` , ( ) =>
14791487 h ( 'textarea' , { value : 'foo' } ) ,
14801488 )
@@ -1483,11 +1491,10 @@ describe('SSR hydration', () => {
14831491 )
14841492 expect ( `Hydration attribute mismatch` ) . not . toHaveBeenWarned ( )
14851493
1486- mountWithHydration ( `<div></div>` , ( ) => h ( 'div' , { id : 'foo' } ) )
1494+ mountWithHydration ( `<textarea>foo</textarea>` , ( ) =>
1495+ h ( 'textarea' , { value : 'bar' } ) ,
1496+ )
14871497 expect ( `Hydration attribute mismatch` ) . toHaveBeenWarned ( )
1488-
1489- mountWithHydration ( `<div id="bar"></div>` , ( ) => h ( 'div' , { id : 'foo' } ) )
1490- expect ( `Hydration attribute mismatch` ) . toHaveBeenWarnedTimes ( 2 )
14911498 } )
14921499
14931500 test ( 'boolean attr handling' , ( ) => {
@@ -1504,5 +1511,10 @@ describe('SSR hydration', () => {
15041511 )
15051512 expect ( `Hydration attribute mismatch` ) . not . toHaveBeenWarned ( )
15061513 } )
1514+
1515+ test ( 'should not warn against object values' , ( ) => {
1516+ mountWithHydration ( `<input />` , ( ) => h ( 'input' , { from : { } } ) )
1517+ expect ( `Hydration attribute mismatch` ) . not . toHaveBeenWarned ( )
1518+ } )
15071519 } )
15081520} )
0 commit comments