/* eslint-disable jest/require-top-level-describe */ import { render } from '@testing-library/react'; import React from 'react'; import { renderWithUserEvent } from '../../../../test/lib/render-helpers'; import { Icon, ICON_NAMES } from '..'; import { BannerBase } from './banner-base'; describe('BannerBase', () => { it('should render bannerbase element correctly', () => { const { getByTestId, container } = render( should render bannerbase element correctly , ); expect(getByTestId('banner-base')).toHaveClass('mm-banner-base'); expect(container).toMatchSnapshot(); }); it('should render with added classname', () => { const { getByTestId } = render( should render bannerbase element correctly , ); expect(getByTestId('banner-base')).toHaveClass('mm-banner-base--test'); }); it('should render bannerbase title', () => { const { getByText } = render(); expect(getByText('Bannerbase title test')).toHaveClass( 'mm-banner-base__title', ); }); it('should render bannerbase description', () => { const { getByText } = render( , ); expect(getByText('Bannerbase description test')).toBeDefined(); }); it('should render bannerbase children', () => { const { getByText } = render( Bannerbase children test, ); expect(getByText('Bannerbase children test')).toBeDefined(); }); it('should render bannerbase action button', () => { const { getByTestId } = render( console.log('ButtonLink actionButtonOnClick demo') } > Use actionButtonLabel for action text, actionButtonOnClick for the onClick handler, and actionButtonProps to pass any ButtonLink prop types such as iconName , ); expect(getByTestId('action')).toHaveClass('mm-banner-base__action'); }); it('should render bannerbase startAccessory', () => { const { getByTestId } = render( } />, ); expect(getByTestId('start-accessory')).toBeDefined(); }); it('should render and fire onClose event', async () => { const onClose = jest.fn(); const { user, getByTestId } = renderWithUserEvent( , ); await user.click(getByTestId('close-button')); expect(onClose).toHaveBeenCalledTimes(1); }); });