File tree 1 file changed +8
-9
lines changed
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', () => {
10
10
} )
11
11
12
12
test ( '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 )
14
17
15
- const container = document . body . appendChild ( document . createElement ( 'div' ) )
16
- container . innerHTML = initial
17
- const input = container . querySelector ( 'input' )
18
18
const firstValue = 'hello'
19
+ initialInputElement . value = firstValue
19
20
20
- if ( ! input ) throw new Error ( 'No element' )
21
- input . value = firstValue
22
21
const { rerender} = render ( < input value = "" onChange = { ( ) => null } /> , {
23
22
container,
24
23
hydrate : true ,
25
24
} )
26
25
27
- const secondValue = 'goodbye'
26
+ expect ( initialInputElement . value ) . toBe ( firstValue )
28
27
29
- expect ( input . value ) . toBe ( firstValue )
28
+ const secondValue = 'goodbye'
30
29
rerender ( < input value = { secondValue } onChange = { ( ) => null } /> )
31
- expect ( input . value ) . toBe ( secondValue )
30
+ expect ( initialInputElement . value ) . toBe ( secondValue )
32
31
} )
You can’t perform that action at this time.
0 commit comments