Tim Arney
Tim Arney

Reputation: 1826

React Uncontrolled Form - null value Jest Test

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

Answers (1)

Tim Arney
Tim Arney

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

Related Questions