File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed
Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -10,23 +10,22 @@ test('rerender will re-render the element', () => {
1010} )
1111
1212test ( 'hydrate will not update props until next render' , ( ) => {
13- const initial = '<input />'
13+ const initialInputElement = document . createElement ( 'input' )
14+ const container = document . createElement ( 'div' )
15+ container . appendChild ( initialInputElement )
16+ document . body . appendChild ( container )
1417
15- const container = document . body . appendChild ( document . createElement ( 'div' ) )
16- container . innerHTML = initial
17- const input = container . querySelector ( 'input' )
1818 const firstValue = 'hello'
19+ initialInputElement . value = firstValue
1920
20- if ( ! input ) throw new Error ( 'No element' )
21- input . value = firstValue
2221 const { rerender} = render ( < input value = "" onChange = { ( ) => null } /> , {
2322 container,
2423 hydrate : true ,
2524 } )
2625
27- const secondValue = 'goodbye'
26+ expect ( initialInputElement . value ) . toBe ( firstValue )
2827
29- expect ( input . value ) . toBe ( firstValue )
28+ const secondValue = 'goodbye'
3029 rerender ( < input value = { secondValue } onChange = { ( ) => null } /> )
31- expect ( input . value ) . toBe ( secondValue )
30+ expect ( initialInputElement . value ) . toBe ( secondValue )
3231} )
You can’t perform that action at this time.
0 commit comments