Test: Form input snapshots

This commit is contained in:
Alex Gleason 2020-06-09 23:00:26 -05:00
parent d2694602b1
commit 144469cda9
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
2 changed files with 186 additions and 0 deletions

View file

@ -0,0 +1,101 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<Checkbox /> renders correctly 1`] = `
<div
className="input boolean"
>
<input
type="checkbox"
value={true}
/>
</div>
`;
exports[`<FieldsGroup /> renders correctly 1`] = `
<div
className="fields-group"
/>
`;
exports[`<FileChooser /> renders correctly 1`] = `
<div
className="input"
>
<input
accept={
Array [
"image/jpeg",
"image/png",
"image/gif",
"image/webp",
]
}
type="file"
/>
</div>
`;
exports[`<InputContainer /> renders correctly 1`] = `
<div
className="input"
/>
`;
exports[`<RadioGroup /> renders correctly 1`] = `
<div
className="input with_floating_label radio_buttons"
>
<div
className="label_input"
>
<label />
<ul />
</div>
</div>
`;
exports[`<SelectDropdown /> renders correctly 1`] = `
<select>
<option
value="one"
>
One
</option>
<option
value="two"
>
Two
</option>
<option
value="three"
>
Three
</option>
</select>
`;
exports[`<SimpleForm /> renders correctly 1`] = `
<form
acceptCharset="UTF-8"
className="simple_form"
onSubmit={[Function]}
/>
`;
exports[`<SimpleInput /> renders correctly 1`] = `
<div
className="input"
>
<input />
</div>
`;
exports[`<TextInput /> renders correctly 1`] = `
<div
className="input"
>
<input
type="text"
/>
</div>
`;

View file

@ -0,0 +1,85 @@
import React from 'react';
import renderer from 'react-test-renderer';
import {
InputContainer,
SimpleInput,
SimpleForm,
FieldsGroup,
Checkbox,
RadioGroup,
SelectDropdown,
TextInput,
FileChooser,
} from '..';
describe('<InputContainer />', () => {
it('renders correctly', () => {
expect(renderer.create(
<InputContainer />
).toJSON()).toMatchSnapshot();
});
});
describe('<SimpleInput />', () => {
it('renders correctly', () => {
expect(renderer.create(
<SimpleInput />
).toJSON()).toMatchSnapshot();
});
});
describe('<SimpleForm />', () => {
it('renders correctly', () => {
expect(renderer.create(
<SimpleForm />
).toJSON()).toMatchSnapshot();
});
});
describe('<FieldsGroup />', () => {
it('renders correctly', () => {
expect(renderer.create(
<FieldsGroup />
).toJSON()).toMatchSnapshot();
});
});
describe('<Checkbox />', () => {
it('renders correctly', () => {
expect(renderer.create(
<Checkbox />
).toJSON()).toMatchSnapshot();
});
});
describe('<RadioGroup />', () => {
it('renders correctly', () => {
expect(renderer.create(
<RadioGroup />
).toJSON()).toMatchSnapshot();
});
});
describe('<SelectDropdown />', () => {
it('renders correctly', () => {
expect(renderer.create(
<SelectDropdown items={{ one: 'One', two: 'Two', three: 'Three' }} />
).toJSON()).toMatchSnapshot();
});
});
describe('<TextInput />', () => {
it('renders correctly', () => {
expect(renderer.create(
<TextInput />
).toJSON()).toMatchSnapshot();
});
});
describe('<FileChooser />', () => {
it('renders correctly', () => {
expect(renderer.create(
<FileChooser />
).toJSON()).toMatchSnapshot();
});
});