I can not set the value of input field. What am I doing wrong? If any more information is needed, please tell me so. Thank you.
describe('SignUpComp', () => {
let signUpComp, node;
beforeEach(() => {
signUpComp = TestUtils.renderIntoDocument(<SignUp />);
node = ReactDOM.findDOMNode(signUpComp);
});
// First name
it('it should trigger error `min chars` if input firstName is too short', () => {
let elements = selectElements('firstName');
TestUtils.Simulate.change(elements.input, { target: { value: 'abc' } });
console.log(elements.input); // I can not see the change
console.log(node); // I can not see the change
expect(elements.error.textContent).to.equal(errorMsg.tooShort('First name', 2));
});
function selectElements(element) {
let input = node.querySelector('#' + element);
let error = node.querySelector('#' + element + '+ p');
return { input, error };
}