UNPKG

@amsterdam/design-system-react

Version:

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

30 lines (29 loc) 1.34 kB
import { jsx as _jsx } from "react/jsx-runtime"; import { render, screen } from '@testing-library/react'; import { createRef } from 'react'; import { Footer } from './Footer'; import '@testing-library/jest-dom'; describe('Page menu link', () => { it('renders with href attribute', () => { render(_jsx(Footer.MenuLink, { href: "#", children: "Link" })); const component = screen.getByRole('link'); expect(component).toBeInTheDocument(); expect(component).toHaveAttribute('href', '#'); }); it('renders a design system BEM class name', () => { render(_jsx(Footer.MenuLink, { href: "#", children: "Link" })); const component = screen.getByRole('link'); expect(component).toHaveClass('ams-footer__menu-link'); }); it('renders an additional class name', () => { render(_jsx(Footer.MenuLink, { className: "extra", href: "#", children: "Link" })); const component = screen.getByRole('link'); expect(component).toHaveClass('ams-footer__menu-link extra'); }); it('supports ForwardRef in React', () => { const ref = createRef(); render(_jsx(Footer.MenuLink, { className: "extra", href: "#", ref: ref, children: "Link" })); const component = screen.getByRole('link'); expect(ref.current).toBe(component); }); });