import { describe, expect, it } from '@jest/globals';
import { render, screen as rtlScreen } from '@testing-library/react';
import { Heading, Icon } from '../../../atoms';
import { Modal } from './modal';
const children =
'Labore ullam delectus sit modi quam dolores. Ratione id sint aliquid facilis ipsum. Unde necessitatibus provident minus.';
describe('Modal', () => {
it('renders the modal contents', () => {
render({children});
expect(rtlScreen.getByText(children)).toBeInTheDocument();
});
it('can render a heading', () => {
const heading = 'A custom heading';
const level = 2;
render(
{heading}}>
{children}
);
expect(rtlScreen.getByRole('heading', { level })).toHaveTextContent(
heading
);
});
it('can render an icon', () => {
const label = 'maxime ut eius';
render(
}>{children}
);
expect(rtlScreen.getByLabelText(label)).toBeInTheDocument();
});
it('can render a close button', () => {
const btn = 'consequatur';
render({children});
expect(rtlScreen.getByRole('button', { name: btn })).toBeInTheDocument();
});
});