import React from "react";
import { mount } from "enzyme";
import InputBlock from ".";
import Button from "../button";
describe("", () => {
it("renders without error", () => {
const mask = [/\d/, /\d/, "/", /\d/, /\d/, "/", /\d/, /\d/, /\d/, /\d/];
const wrapper = mount(
alert(event.target.value)}
onChange={(event) => alert(event.target.value)}
>
);
expect(wrapper).toExist();
});
it("test base size props", () => {
const wrapper = mount(
);
expect(wrapper.prop("size")).toBe("base");
});
it("test middle size props", () => {
const wrapper = mount(
);
expect(wrapper.prop("size")).toBe("middle");
});
it("test big size props", () => {
const wrapper = mount(
);
expect(wrapper.prop("size")).toBe("big");
});
it("test huge size props", () => {
const wrapper = mount(
);
expect(wrapper.prop("size")).toBe("huge");
});
it("test iconSize props", () => {
const wrapper = mount(
);
expect(wrapper.prop("iconSize")).toBe(18);
});
it("test empty props", () => {
const wrapper = mount();
expect(wrapper).toExist();
});
it("accepts id", () => {
const wrapper = mount();
expect(wrapper.prop("id")).toEqual("testId");
});
it("accepts className", () => {
const wrapper = mount();
expect(wrapper.prop("className")).toEqual("test");
});
it("accepts style", () => {
const wrapper = mount();
expect(wrapper.getDOMNode().style).toHaveProperty("color", "red");
});
//TODO: Fix tests
/* it("call onChange", () => {
const onChange = jest.fn();
const wrapper = mount(
);
const input = wrapper.find("input");
input.first().simulate("change", { target: { value: "test" } });
expect(onChange).toHaveBeenCalled();
});
it("call onIconClick", () => {
const onIconClick = jest.fn();
const wrapper = mount(
);
const input = wrapper.find(".append div");
input.first().simulate("click");
expect(onIconClick).toHaveBeenCalled();
});
it("not call onChange", () => {
const onChange = jest.fn();
const wrapper = mount(
);
const input = wrapper.find("input");
input.first().simulate("change", { target: { value: "test" } });
expect(onChange).not.toHaveBeenCalled();
});
it("not call onIconClick", () => {
const onIconClick = jest.fn();
const wrapper = mount(
);
const input = wrapper.find(".append div");
input.first().simulate("click");
expect(onIconClick).not.toHaveBeenCalled();
});*/
});