UNPKG

@panoramax/web-viewer

Version:

Panoramax web viewer for geolocated pictures

32 lines (27 loc) 845 B
import { faChevronDown } from "@fortawesome/free-solid-svg-icons/faChevronDown"; import * as widgets from "../../src/utils/widgets"; describe("fa", () => { it("works", () => { const res = widgets.fa(faChevronDown); expect(res).toMatchSnapshot(); }); }); describe("createWebComp", () => { it("works", () => { const tag = "custom-element"; const props = { id: "test-id", class: "test-class", _customProp: "secret", fnDoSomething: jest.fn(), onClick: jest.fn(), }; const wc = widgets.createWebComp(tag, props); expect(wc).toBeInstanceOf(HTMLElement); expect(wc.tagName.toLowerCase()).toBe(tag); expect(wc.getAttribute("id")).toBe(props.id); expect(wc.getAttribute("class")).toBe(props.class); expect(wc._customProp).toBe(props._customProp); expect(wc.DoSomething).toBe(props.fnDoSomething); }); });