phoenix-components-library
Version:
Component library for Phoenix Frontend Projects.
51 lines (46 loc) • 1.2 kB
JSX
import React from "react";
import renderer from "react-test-renderer";
import { Input } from "./Input";
describe("<Input /> ", () => {
test("Render Input correctly", () => {
const tree = renderer
.create(<Input type="text" name="Input Test" />)
.toJSON();
expect(tree).toMatchSnapshot();
});
test("Render Input with placeholder", () => {
const tree = renderer
.create(
<Input type="text" name="Input Test" placeholder="Test Placeholder" />
)
.toJSON();
expect(tree).toMatchSnapshot();
});
test("Test Input with already filled value", () => {
const tree = renderer
.create(
<Input
type="text"
name="Input Test"
placeholder="Test Placeholder"
value="Input Test"
/>
)
.toJSON();
expect(tree).toMatchSnapshot();
});
test("Test Input which is disabled", () => {
const tree = renderer
.create(
<Input
type="text"
name="Input Test"
placeholder="Test Placeholder"
disabled={true}
value="Input Test"
/>
)
.toJSON();
expect(tree).toMatchSnapshot();
});
});