0

当我通过 Jest 测试不受控制的表单时,我的onChange处理程序会收到新值,但是当我确认它返回的值时Null

我在这里做了一个测试 - https://github.com/timarney/react-formtest

我必须使用 aControlled FormReactLink吗? http://facebook.github.io/react/docs/two-way-binding-helpers.html

4

1 回答 1

1

看:

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');

于 2015-02-18T21:11:22.303 回答