UNPKG

@public-ui/components

Version:

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

32 lines (31 loc) 1.65 kB
/*! * KoliBri - The accessible HTML-Standard */ import { h } from "@stencil/core"; import { renderFunctionalComponentToSpecPage } from "../../../utils/testing"; import ToastItemFc from "../ToastItem"; describe('ToastItemFc', () => { const mockOnClose = jest.fn(); const basicToast = { type: 'info', label: 'Test Toast', description: 'Test Description', variant: 'card', }; it('should render with basic props and status', async () => { var _a, _b, _c, _d; const page = await renderFunctionalComponentToSpecPage(() => h(ToastItemFc, { toast: basicToast, onClose: mockOnClose, status: "settled" })); expect(page.root).toMatchSnapshot(); expect((_b = (_a = page.root) === null || _a === void 0 ? void 0 : _a.querySelector('.kol-alert__heading')) === null || _b === void 0 ? void 0 : _b.textContent).toContain('Test Toast'); expect((_d = (_c = page.root) === null || _c === void 0 ? void 0 : _c.querySelector('.kol-alert__content')) === null || _d === void 0 ? void 0 : _d.textContent).toContain('Test Description'); }); it('should render with different status classes', async () => { var _a; const statuses = ['adding', 'settled', 'removing']; for (const status of statuses) { const page = await renderFunctionalComponentToSpecPage(() => h(ToastItemFc, { toast: basicToast, onClose: mockOnClose, status: status })); expect((_a = page.root) === null || _a === void 0 ? void 0 : _a.classList.contains(`kol-toast-item--${status}`)).toBeTruthy(); } }); }); //# sourceMappingURL=snapshot.test.js.map