react-form-controlled
Version:
Intuitive react forms for building powerful applications
36 lines (29 loc) • 829 B
JavaScript
import React from 'react';
import { mount } from 'enzyme';
import Form from '../src';
describe('Form', () => {
it('should be able to create simple instance', () => {
const value = {
inputValue: 123
};
const wrapper = mount(React.createElement(Form, { value: value }));
expect(wrapper.find('form').length).toBe(1);
});
it('should be able to call onSubmit', done => {
const value = {
inputValue: 123
};
const wrapper = mount(React.createElement(
Form,
{ value: value, onSubmit: () => done(), skipReplace: true },
React.createElement(
'button',
{ type: 'submit' },
'submit'
)
));
expect(wrapper.find('form').length).toBe(1);
wrapper.find('[type="submit"]').at(0).click();
});
});
//# sourceMappingURL=Form.test.js.map