@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.26 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { render } from '@testing-library/react';
import { createRef } from 'react';
import { MegaMenu } from './MegaMenu';
import '@testing-library/jest-dom';
describe('Mega menu', () => {
it('renders', () => {
const { container } = render(_jsx(MegaMenu, {}));
const component = container.querySelector(':only-child');
expect(component).toBeInTheDocument();
expect(component).toBeVisible();
});
it('renders a design system BEM class name', () => {
const { container } = render(_jsx(MegaMenu, {}));
const component = container.querySelector(':only-child');
expect(component).toHaveClass('ams-mega-menu');
});
it('renders an additional class name', () => {
const { container } = render(_jsx(MegaMenu, { className: "extra" }));
const component = container.querySelector(':only-child');
expect(component).toHaveClass('ams-mega-menu extra');
});
it('supports ForwardRef in React', () => {
const ref = createRef();
const { container } = render(_jsx(MegaMenu, { ref: ref }));
const component = container.querySelector(':only-child');
expect(ref.current).toBe(component);
});
});