/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ import React from "react"; import { shallow } from "enzyme"; import { Modal } from "../Modal"; describe("Modal", () => { it("renders", () => { const wrapper = shallow( {}} status="entering" />); expect(wrapper).toMatchSnapshot(); }); it("handles close modal click", () => { const handleCloseSpy = jest.fn(); const wrapper = shallow( ); wrapper.find(".modal-wrapper").simulate("click"); expect(handleCloseSpy).toHaveBeenCalled(); }); it("renders children", () => { const children =
; const wrapper = shallow( {}} status="entering" /> ); expect(wrapper.find(".aChild")).toHaveLength(1); }); it("passes additionalClass to child div class", () => { const additionalClass = "testAddon"; const wrapper = shallow( {}} status="entering" /> ); expect(wrapper.find(`.modal-wrapper .${additionalClass}`)).toHaveLength(1); }); it("passes status to child div class", () => { const status = "testStatus"; const wrapper = shallow( {}} />); expect(wrapper.find(`.modal-wrapper .${status}`)).toHaveLength(1); }); });