ui-neu
Version:
Neu UI, a responsive React component library.
31 lines (30 loc) • 842 B
JavaScript
import React from "react";
import { act } from "react-dom/test-utils";
import ReactDom from "react-dom";
import { Input } from "./Input";
var container = null;
beforeEach(function () {
container = document.createElement("div");
document.body.appendChild(container);
});
afterEach(function () {
document.body.removeChild(container);
container = null;
});
it("render input and update", function () {
// Test first render
act(function () {
ReactDom.render( /*#__PURE__*/React.createElement(Input, {
placeholder: "test",
id: "test",
name: "input",
type: "text"
}), container);
});
var input = document.getElementById("test");
expect(input.type).toBe("text"); // Test second render and update
act(function () {
input.value = "test value";
});
expect(input.value).toBe("test value");
});