import React from "react"; import { mount, shallow } from "enzyme"; import Row from "."; const baseProps = { checked: false, element: 1, contextOptions: [{ key: "1", label: "test" }], children: Some text, }; describe("", () => { it("renders without error", () => { const wrapper = mount(); expect(wrapper).toExist(); }); it("call changeCheckbox(e)", () => { const onSelect = jest.fn(); const wrapper = shallow( ); wrapper.simulate("change", { target: { checked: true } }); expect(onSelect).toHaveBeenCalled(); }); it("renders with children", () => { const wrapper = mount(); expect(wrapper).toHaveProp("children", baseProps.children); }); it("renders with contentElement and sectionWidth", () => { const element =
content
; const wrapper = mount( ); expect(wrapper).toHaveProp("contentElement", element); }); it("can apply contextButtonSpacerWidth", () => { const test = "10px"; const wrapper = mount( ); expect(wrapper).toHaveProp("contextButtonSpacerWidth", test); }); it("can apply data property", () => { const test = { test: "test" }; const wrapper = mount(); expect(wrapper).toHaveProp("data", test); }); it("can apply indeterminate", () => { const test = true; const wrapper = mount(); expect(wrapper).toHaveProp("indeterminate", test); }); 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"); }); });