UNPKG

@public-ui/components

Version:

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

38 lines (37 loc) 1.83 kB
/*! * KoliBri - The accessible HTML-Standard */ import { h } from "@stencil/core"; import { renderFunctionalComponentToSpecPage } from "../../../utils/testing"; import KolFormFieldHintFc from "../FormFieldHint"; describe('KolFormFieldHintFc', () => { it('should render with hint', async () => { var _a; const hint = 'This is a hint'; const id = 'test-id'; const classNames = 'custom-class'; const page = await renderFunctionalComponentToSpecPage(() => h(KolFormFieldHintFc, { hint: hint, id: id, class: classNames })); expect(page.root).toMatchSnapshot(); expect((_a = page.root) === null || _a === void 0 ? void 0 : _a.textContent).toContain(hint); }); it('should not render without hint', async () => { const page = await renderFunctionalComponentToSpecPage(() => h(KolFormFieldHintFc, null)); expect(page.root).toBeNull(); }); it('should set the correct id', async () => { var _a; const hint = 'This is a hint'; const id = 'test-id'; const page = await renderFunctionalComponentToSpecPage(() => h(KolFormFieldHintFc, { hint: hint, id: id })); expect((_a = page.root) === null || _a === void 0 ? void 0 : _a.id).toBe('test-id-hint'); }); it('should set the correct class names', async () => { var _a, _b; const hint = 'This is a hint'; const classNames = 'custom-class'; const page = await renderFunctionalComponentToSpecPage(() => h(KolFormFieldHintFc, { hint: hint, class: classNames })); expect((_a = page.root) === null || _a === void 0 ? void 0 : _a.className).toContain('hint'); expect((_b = page.root) === null || _b === void 0 ? void 0 : _b.className).toContain(classNames); }); }); //# sourceMappingURL=snapshot.test.js.map