Current behavior
As the title says, when I try to simulate a change on my <input/>, the input's value remains the same - it doesn't change.
Here is my HTML. This <input/> is within a <form/>
<input
className="w-100 ba b--black-20 br1 pa3 bg--easy-gray mb2"
type="text"
name="firstName"
ref={register({ required: true })}
/>
register is from the useForm hook of react-hook-form.
Here is my mount.
const signup = mount(
<Provider store={mockStore}>
<Router history={history}>
<Signup />
</Router>
</Provider>,
)
The <form/> and <input/> are within the <Signup/> component.
Here is my enzyme code
const firstNameInput = signup.findWhere((n) => n.prop('name') === 'firstName')
firstNameInput.simulate('change', {target: {value: 'Nikhil'}})
await act( async () => {
signup.update();
})
console.log(firstNameInput.props())
Here is the output
{
className: 'w-100 ba b--black-20 br1 pa3 bg--easy-gray mb2',
type: 'text',
name: 'firstName'
}
I don't see value anywhere.
Expected behavior
{
className: 'w-100 ba b--black-20 br1 pa3 bg--easy-gray mb2',
type: 'text',
name: 'firstName',
value: 'Nikhil'
}
Your environment
API
Version
| library |
version |
| enzyme |
^3.11.0 |
| react |
^16.13.1 |
| react-dom |
^16.13.1" |
| react-test-renderer |
|
| adapter (below) |
|
Adapter
Current behavior
As the title says, when I try to
simulateachangeon my<input/>, the input'svalueremains the same - it doesn't change.Here is my HTML. This
<input/>is within a<form/>registeris from theuseFormhook ofreact-hook-form.Here is my mount.
The
<form/>and<input/>are within the<Signup/>component.Here is my enzyme code
Here is the output
I don't see
valueanywhere.Expected behavior
Your environment
API
Version
Adapter