Adding test for FormField, InputDescription and Spinner

This commit is contained in:
Belen Curcio
2018-08-17 09:25:13 -03:00
parent e1dc50a494
commit 63d43caa23
6 changed files with 110 additions and 0 deletions
@@ -0,0 +1,26 @@
import React from "react";
import TestRenderer from "react-test-renderer";
import FormField from "../FormField";
import { InputDescription, InputLabel, TextField } from "../../components";
it("renders correctly", () => {
const renderer = TestRenderer.create(
<FormField>Form Components should go here</FormField>
);
expect(renderer.toJSON()).toMatchSnapshot();
});
it("works with multiple form components", () => {
const renderer = TestRenderer.create(
<FormField>
<InputLabel>Username</InputLabel>
<InputDescription>
A unique identifier displayed on your comments. You may use _ and .
</InputDescription>
<TextField />
</FormField>
);
expect(renderer.toJSON()).toMatchSnapshot();
});
@@ -0,0 +1,30 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders correctly 1`] = `
<div
className="FormField-root FormField-itemGutter"
>
Form Components should go here
</div>
`;
exports[`works with multiple form components 1`] = `
<div
className="FormField-root FormField-itemGutter"
>
<label
className="Typography-root Typography-inputLabel Typography-colorTextPrimary InputLabel-root"
>
Username
</label>
<p
className="Typography-root Typography-inputDescription Typography-colorTextSecondary"
>
A unique identifier displayed on your comments. You may use “_” and “.”
</p>
<input
className="TextField-root TextField-colorRegular TextField-fullWidth"
placeholder=""
/>
</div>
`;
@@ -0,0 +1,11 @@
import React from "react";
import TestRenderer from "react-test-renderer";
import InputDescription from "../InputDescription";
it("renders correctly", () => {
const renderer = TestRenderer.create(
<InputDescription>Form Components should go here</InputDescription>
);
expect(renderer.toJSON()).toMatchSnapshot();
});
@@ -0,0 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders correctly 1`] = `
<p
className="Typography-root Typography-inputDescription Typography-colorTextSecondary"
>
Form Components should go here
</p>
`;
@@ -0,0 +1,9 @@
import React from "react";
import TestRenderer from "react-test-renderer";
import Spinner from "../Spinner";
it("renders correctly", () => {
const renderer = TestRenderer.create(<Spinner />);
expect(renderer.toJSON()).toMatchSnapshot();
});
@@ -0,0 +1,25 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders correctly 1`] = `
<div
className="Spinner-root"
>
<svg
className="Spinner-spinner"
height="40px"
viewBox="0 0 66 66"
width="40px"
xmlns="http://www.w3.org/2000/svg"
>
<circle
className="Spinner-path"
cx="33"
cy="33"
fill="none"
r="30"
strokeLinecap="round"
strokeWidth="6"
/>
</svg>
</div>
`;