UNPKG

@amsterdam/design-system-react

Version:

All React components from the Amsterdam Design System. Use it to compose pages in your website or application.

35 lines (34 loc) 1.62 kB
import { jsx as _jsx } from "react/jsx-runtime"; import { render, screen } from '@testing-library/react'; import { createRef } from 'react'; import { CardHeadingGroup } from './CardHeadingGroup'; import '@testing-library/jest-dom'; describe('Card heading group', () => { it('renders', () => { const { container } = render(_jsx(CardHeadingGroup, { tagline: "test" })); const component = container.querySelector(':only-child'); expect(component).toBeInTheDocument(); expect(component).toBeVisible(); }); it('renders a design system BEM class name', () => { const { container } = render(_jsx(CardHeadingGroup, { tagline: "test" })); const component = container.querySelector(':only-child'); expect(component).toHaveClass('ams-card__heading-group'); }); it('renders an additional class name', () => { const { container } = render(_jsx(CardHeadingGroup, { className: "extra", tagline: "test" })); const component = container.querySelector(':only-child'); expect(component).toHaveClass('ams-card__heading-group extra'); }); it('renders a tagline', () => { render(_jsx(CardHeadingGroup, { tagline: "tagline" })); const tagline = screen.getByText('tagline'); expect(tagline).toBeInTheDocument(); }); it('supports ForwardRef in React', () => { const ref = createRef(); const { container } = render(_jsx(CardHeadingGroup, { ref: ref, tagline: "test" })); const component = container.querySelector(':only-child'); expect(ref.current).toBe(component); }); });