Last active
October 21, 2018 16:12
-
-
Save takethefake/d877628fbd680e3c7b36fefb9305e66f to your computer and use it in GitHub Desktop.
Medium: Jest test with React DOM rendering
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from "react"; | |
import ReactDOM from "react-dom"; | |
import { Input } from "../"; | |
test("it initializes with a defaultValue", () => { | |
const containerDiv = document.createElement("div"); | |
const defaultValue = "DefaultValue"; | |
ReactDOM.render(<Input initialValue={defaultValue} />, containerDiv); | |
expect(containerDiv.querySelector("input").value).toBe( | |
defaultValue | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment