Add basic unit test for the Title component
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Title renders correctly 1`] = `
|
||||
<div
|
||||
className="flex justify-center items-start flex-col w-full px-2 sm:px-6 mb-10"
|
||||
>
|
||||
<div
|
||||
className="text-xl sm:text-2xl font-bold font-title mt-2 mb-2"
|
||||
>
|
||||
Title
|
||||
</div>
|
||||
<div
|
||||
className="flex justify-start items-center w-full text-regular text-xs sm:text-lg"
|
||||
>
|
||||
<input
|
||||
className="outline-none w-24 sm:w-40 mr-10 border-t-0 border-l-0 border-r-0 border solid border-gray-900 py-1 px-2 focus:border-blue-700 prefix"
|
||||
id="title-prefix"
|
||||
onChange={[Function]}
|
||||
value="Hi 👋, I'm"
|
||||
/>
|
||||
<input
|
||||
className="outline-none placeholder-gray-700 w-1/2 sm:w-1/3 border-t-0 border-l-0 border-r-0 border solid border-gray-900 py-1 px-2 focus:border-blue-700"
|
||||
id="title-name"
|
||||
onChange={[Function]}
|
||||
placeholder="name"
|
||||
value=""
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
@@ -0,0 +1,13 @@
|
||||
import React from "react"
|
||||
import renderer from "react-test-renderer"
|
||||
|
||||
import Title from "../title"
|
||||
|
||||
describe("Title", () => {
|
||||
it("renders correctly", () => {
|
||||
const tree = renderer
|
||||
.create(<Title prefix={{ title: "Hi 👋, I'm" }} data={{ title: "" }} />)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user