find value number in enzym code example
Example 1: find value number in enzym
const emailField = orderPageWrapper.find('input[name="email"]')
emailField.simulate('focus')
emailField.simulate('change', { target: { value: '[email protected]', name: 'email' } })
emailField.simulate('blur')
Example 2: find value number in enzym
const wrapper = mount(<EditableText defaultValue="Hello" />);
const input = wrapper.find('input');
console.log(input.node.value);
Example 3: find value number in enzym
it('cancels changes when user presses esc', done => {
const wrapper = mount(<EditableText defaultValue="Hello" />);
const input = wrapper.find('input');
input.simulate('focus');
input.simulate('change', { target: { value: 'Changed' } });
input.simulate('keyDown', {
which: 27,
target: {
blur() {
input.simulate('blur');
},
},
});
expect(input.get(0).value).to.equal('Hello');
done();
Example 4: find value number in enzym
wrapper.find('input').simulate("change", { target: { value: "foo" }}) to invoke onChange