Web.Components: EmailInput: added new test

This commit is contained in:
Daniil Senkiv 2019-10-16 08:58:06 +03:00
parent d36166e41d
commit 6734931fe1

View File

@ -58,6 +58,22 @@ describe('<EmailInput />', () => {
expect(shouldUpdate).toBe(true); expect(shouldUpdate).toBe(true);
expect(wrapper.state('emailSettings')).toBe(emailSettings); expect(wrapper.state('emailSettings')).toBe(emailSettings);
}); });
it('isValidEmail is "true" after deleting value', () => {
const wrapper = mount(<EmailInput {...baseProps} />);
const event = { target: { value: "test" } };
wrapper.simulate('change', event);
expect(wrapper.state('isValidEmail')).toBe(false);
const emptyValue = { target: { value: "" } };
wrapper.simulate('change', emptyValue);
expect(wrapper.state('isValidEmail')).toBe(true);
});
it('not re-render test', () => { it('not re-render test', () => {
const wrapper = shallow(<EmailInput {...baseProps} />).instance(); const wrapper = shallow(<EmailInput {...baseProps} />).instance();