import React from "react"; import { mount, shallow } from "enzyme"; import DropDownItem from "."; const baseProps = { isSeparator: false, isHeader: false, tabIndex: -1, label: "test", disabled: false, icon: "static/images/nav.logo.react.svg", noHover: false, onClick: jest.fn(), }; describe("", () => { it("renders without error", () => { const wrapper = mount(); expect(wrapper).toExist(); }); it("check disabled props", () => { const wrapper = mount(); expect(wrapper.prop("disabled")).toEqual(true); }); it("check isSeparator props", () => { const wrapper = mount(); expect(wrapper.prop("isSeparator")).toEqual(true); }); it("check isHeader props", () => { const wrapper = mount(); expect(wrapper.prop("isHeader")).toEqual(true); }); it("check noHover props", () => { const wrapper = mount(); expect(wrapper.prop("noHover")).toEqual(true); }); it("causes function onClick()", () => { const onClick = jest.fn(); const wrapper = shallow( ); wrapper.find("#test").simulate("click"); expect(onClick).toHaveBeenCalled(); }); it("render without child", () => { const wrapper = shallow(test); expect(wrapper.props.children).toEqual(undefined); }); 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"); }); });