import React from 'react'; import Input from '../../src/react/Input.js'; import renderer from 'react-test-renderer'; import {mount} from 'enzyme'; class InputForm extends React.Component { constructor(props) { super(props); this.state = {value: 'Initial'}; this.handleChange = this.handleChange.bind(this); } handleChange(val) { this.setState({value: val}); } getValue() { return this.input.getValue(); } render() { return (
); } } describe('Input', () => { test('Input - default', () => { const input = renderer.create().toJSON(); expect(input).toMatchSnapshot(); }); test('Input - required', () => { const input = renderer.create().toJSON(); expect(input).toMatchSnapshot(); }); test('Input - number', () => { const input = renderer.create().toJSON(); expect(input).toMatchSnapshot(); }); test('Input - readonly', () => { const input = renderer.create().toJSON(); expect(input).toMatchSnapshot(); }); test('Input - placeholder', () => { const input = renderer.create().toJSON(); expect(input).toMatchSnapshot(); }); test('Input - error', () => { const input = renderer.create().toJSON(); expect(input).toMatchSnapshot(); }); test('Input - checked state value changes', () => { const input = mount(