/* eslint-disable jest/require-top-level-describe */ import { render, fireEvent } from '@testing-library/react'; import React from 'react'; import { ModalHeader } from './modal-header'; describe('ModalHeader', () => { it('should render ModalHeader correctly', () => { const { getByTestId, container } = render( Modal header, ); expect(getByTestId('modal-header')).toHaveClass('mm-modal-header'); expect(container).toMatchSnapshot(); }); it('should render modal header children as a string', () => { const { getByText } = render( Modal header test, ); expect(getByText('Modal header test')).toBeDefined(); }); it('should render modal header children as a node', () => { const { getByText, getByTestId } = render(
Modal header test
, ); expect(getByText('Modal header test')).toBeDefined(); expect(getByTestId('div')).toBeDefined(); }); it('should render modal header back button', () => { const onBackTest = jest.fn(); const { getByTestId } = render( ModalHeader , ); const backButton = getByTestId('back'); fireEvent.click(backButton); expect(onBackTest).toHaveBeenCalled(); }); it('should render modal header close button', () => { const onCloseTest = jest.fn(); const { getByTestId } = render( Modal header , ); const closeButton = getByTestId('close'); fireEvent.click(closeButton); expect(onCloseTest).toHaveBeenCalled(); }); });