import React from "react"; import { mount, shallow } from "enzyme"; import RowContainer from "."; const baseProps = { manualHeight: "500px", }; describe("", () => { it("renders without error", () => { const wrapper = mount( Demo ); expect(wrapper).toExist(); }); it("renders without manualHeight", () => { const wrapper = mount( Demo ); expect(wrapper).toExist(); }); it("call onRowContextClick() with normal options", () => { const options = [ { key: "1", label: "test", }, ]; const wrapper = mount( Demo ); const instance = wrapper.instance(); instance.onRowContextClick(options); expect(wrapper.state("contextOptions")).toEqual(options); }); it("call onRowContextClick() with wrong options", () => { const options = { key: "1", label: "test", }; const wrapper = mount( Demo ); const instance = wrapper.instance(); instance.onRowContextClick(options); expect(wrapper.state("contextOptions")).toEqual([]); }); it("componentWillUnmount() props lifecycle test", () => { const wrapper = shallow( Demo ); const instance = wrapper.instance(); instance.componentWillUnmount(); expect(wrapper).toExist(false); }); it("render with normal rows", () => { const wrapper = mount(
test
); expect(wrapper).toExist(); }); it("accepts id", () => { const wrapper = mount( Demo ); expect(wrapper.prop("id")).toEqual("testId"); }); it("accepts className", () => { const wrapper = mount( Demo ); expect(wrapper.prop("className")).toEqual("test"); }); it("accepts style", () => { const wrapper = mount( Demo ); expect(wrapper.getDOMNode().style).toHaveProperty("color", "red"); }); });