import { create } from 'react-test-renderer';
import Tag from './Tag';
import TextField from './TextField';
describe('TextField', () => {
it('Renders an FormErrorMessage if an error message is passed in', () => {
const component = create(
,
);
expect(JSON.stringify(component.toJSON())).toContain('Error message');
});
it('Does not render an FormErrorMessage when errorMessage is null', () => {
const component = create();
expect(JSON.stringify(component.toJSON())).not.toContain('Error message');
});
it('TextField normal', () => {
const tree = create(
,
).toJSON();
expect(tree).toMatchSnapshot();
});
it('TextField with error', () => {
const tree = create(
,
).toJSON();
expect(tree).toMatchSnapshot();
});
it('TextField with enterKeyHint', () => {
const tree = create(
,
).toJSON();
expect(tree).toMatchSnapshot();
});
it('TextField with hasError', () => {
const tree = create(
,
).toJSON();
expect(tree).toMatchSnapshot();
});
it('TextField with disabled', () => {
const tree = create(
,
).toJSON();
expect(tree).toMatchSnapshot();
});
it('TextField with readOnly', () => {
const tree = create(
,
).toJSON();
expect(tree).toMatchSnapshot();
});
it('TextField with name', () => {
const tree = create(
,
).toJSON();
expect(tree).toMatchSnapshot();
});
it('TextField with maxLength character counter', () => {
const tree = create(
,
).toJSON();
expect(tree).toMatchSnapshot();
});
it('TextField with autocomplete', () => {
const tree = create(
,
).toJSON();
expect(tree).toMatchSnapshot();
});
it('TextField with tags', () => {
const tree = create(
{}}
text="a@pinterest.com"
/>,
{}}
text="b@pinterest.com"
/>,
{}}
text="c@pinterest.com"
/>,
]}
/>,
).toJSON();
expect(tree).toMatchSnapshot();
});
});