Reputation: 1826
When I'm testing an uncontrolled form via Jest my onChange
handler receives the new values but when I confirm the value it returns Null
.
I put together a test here - https://github.com/timarney/react-formtest
Do I have to use either a Controlled Form
or ReactLink
?
http://facebook.github.io/react/docs/two-way-binding-helpers.html
Upvotes: 0
Views: 605
Reputation: 1826
See:
https://github.com/facebook/react/issues/3151
var node = el.getDOMNode();
node.value = 'new value';
TestUtils.Simulate.change(node);
expect(node.value).toEqual('new value');
Upvotes: 1