UNPKG

@public-ui/components

Version:

Contains all web components that belong to KoliBri - The accessible HTML-Standard.

41 lines (40 loc) 2.39 kB
/*! * KoliBri - The accessible HTML-Standard */ import { h } from "@stencil/core"; import { renderFunctionalComponentToSpecPage } from "../../../utils/testing"; import KolIconButtonFc from "../../IconButton"; import KolInputContainerFc from "../InputContainer"; describe('KolInputContainerFc', () => { it('should render correctly', async () => { var _a; const page = await renderFunctionalComponentToSpecPage(() => h(KolInputContainerFc, null)); expect(page.root).toMatchSnapshot(); expect((_a = page.root) === null || _a === void 0 ? void 0 : _a.tagName).toBe('DIV'); }); it('should render with startAdornment', async () => { var _a; const page = await renderFunctionalComponentToSpecPage(() => (h(KolInputContainerFc, { startAdornment: (h(KolIconButtonFc, { componentName: "icon", icon: "start-icon" })) }))); expect(page.root).toMatchSnapshot(); expect((_a = page.root) === null || _a === void 0 ? void 0 : _a.querySelector('i')).not.toBeNull(); }); it('should render with endAdornment', async () => { var _a; const page = await renderFunctionalComponentToSpecPage(() => (h(KolInputContainerFc, { endAdornment: (h(KolIconButtonFc, { componentName: "icon", icon: "end-icon" })) }))); expect(page.root).toMatchSnapshot(); expect((_a = page.root) === null || _a === void 0 ? void 0 : _a.querySelector('i')).not.toBeNull(); }); it('should render with both startAdornment and endAdornment', async () => { var _a; const page = await renderFunctionalComponentToSpecPage(() => (h(KolInputContainerFc, { startAdornment: (h(KolIconButtonFc, { componentName: "icon", icon: "start-icon" })), endAdornment: (h(KolIconButtonFc, { componentName: "icon", icon: "end-icon" })) }))); expect(page.root).toMatchSnapshot(); expect((_a = page.root) === null || _a === void 0 ? void 0 : _a.querySelectorAll('i')).toHaveLength(2); }); it('should render with children', async () => { var _a; const page = await renderFunctionalComponentToSpecPage(() => (h(KolInputContainerFc, null, h("input", { type: "text" })))); expect(page.root).toMatchSnapshot(); expect((_a = page.root) === null || _a === void 0 ? void 0 : _a.querySelector('input')).not.toBeNull(); }); }); //# sourceMappingURL=snapshot.test.js.map