@@ -1080,13 +1080,11 @@ describe('SSR hydration', () => {
1080
1080
} )
1081
1081
1082
1082
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
+ } ) ,
1090
1088
)
1091
1089
expect ( ( container . firstChild ! as any ) . indeterminate ) . toBe ( true )
1092
1090
} )
@@ -1475,6 +1473,16 @@ describe('SSR hydration', () => {
1475
1473
mountWithHydration ( `<select multiple></div>` , ( ) =>
1476
1474
h ( 'select' , { multiple : 'multiple' } ) ,
1477
1475
)
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' , ( ) => {
1478
1486
mountWithHydration ( `<textarea>foo</textarea>` , ( ) =>
1479
1487
h ( 'textarea' , { value : 'foo' } ) ,
1480
1488
)
@@ -1483,11 +1491,10 @@ describe('SSR hydration', () => {
1483
1491
)
1484
1492
expect ( `Hydration attribute mismatch` ) . not . toHaveBeenWarned ( )
1485
1493
1486
- mountWithHydration ( `<div></div>` , ( ) => h ( 'div' , { id : 'foo' } ) )
1494
+ mountWithHydration ( `<textarea>foo</textarea>` , ( ) =>
1495
+ h ( 'textarea' , { value : 'bar' } ) ,
1496
+ )
1487
1497
expect ( `Hydration attribute mismatch` ) . toHaveBeenWarned ( )
1488
-
1489
- mountWithHydration ( `<div id="bar"></div>` , ( ) => h ( 'div' , { id : 'foo' } ) )
1490
- expect ( `Hydration attribute mismatch` ) . toHaveBeenWarnedTimes ( 2 )
1491
1498
} )
1492
1499
1493
1500
test ( 'boolean attr handling' , ( ) => {
@@ -1504,5 +1511,10 @@ describe('SSR hydration', () => {
1504
1511
)
1505
1512
expect ( `Hydration attribute mismatch` ) . not . toHaveBeenWarned ( )
1506
1513
} )
1514
+
1515
+ test ( 'should not warn against object values' , ( ) => {
1516
+ mountWithHydration ( `<input />` , ( ) => h ( 'input' , { from : { } } ) )
1517
+ expect ( `Hydration attribute mismatch` ) . not . toHaveBeenWarned ( )
1518
+ } )
1507
1519
} )
1508
1520
} )
0 commit comments