当我通过 Jest 测试不受控制的表单时,我的onChange
处理程序会收到新值,但是当我确认它返回的值时Null
。
我在这里做了一个测试 - https://github.com/timarney/react-formtest
我必须使用 aControlled Form
或ReactLink
吗?
http://facebook.github.io/react/docs/two-way-binding-helpers.html
当我通过 Jest 测试不受控制的表单时,我的onChange
处理程序会收到新值,但是当我确认它返回的值时Null
。
我在这里做了一个测试 - https://github.com/timarney/react-formtest
我必须使用 aControlled Form
或ReactLink
吗?
http://facebook.github.io/react/docs/two-way-binding-helpers.html
看:
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');