2023-03-23 16:24:23 +01:00
|
|
|
/* eslint-disable jest/require-top-level-describe */
|
|
|
|
import { render } from '@testing-library/react';
|
|
|
|
import React from 'react';
|
2023-04-04 18:48:04 +02:00
|
|
|
import { Icon, IconName } from '..';
|
2023-03-23 16:24:23 +01:00
|
|
|
import { HeaderBase } from './header-base';
|
|
|
|
|
|
|
|
describe('HeaderBase', () => {
|
|
|
|
it('should render HeaderBase element correctly', () => {
|
|
|
|
const { getByTestId, container } = render(
|
|
|
|
<HeaderBase data-testid="header-base" title="HeaderBase test">
|
|
|
|
should render HeaderBase element correctly
|
|
|
|
</HeaderBase>,
|
|
|
|
);
|
|
|
|
expect(getByTestId('header-base')).toHaveClass('mm-header-base');
|
|
|
|
expect(container).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should render with added classname', () => {
|
|
|
|
const { getByTestId } = render(
|
|
|
|
<HeaderBase
|
|
|
|
className="mm-header-base--test"
|
|
|
|
data-testid="header-base"
|
|
|
|
title="HeaderBase test"
|
|
|
|
>
|
|
|
|
should render HeaderBase element correctly
|
|
|
|
</HeaderBase>,
|
|
|
|
);
|
|
|
|
expect(getByTestId('header-base')).toHaveClass('mm-header-base--test');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should render HeaderBase children', () => {
|
|
|
|
const { getByText } = render(
|
|
|
|
<HeaderBase>HeaderBase children test</HeaderBase>,
|
|
|
|
);
|
|
|
|
expect(getByText('HeaderBase children test')).toBeDefined();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should render HeaderBase startAccessory', () => {
|
|
|
|
const { getByTestId } = render(
|
|
|
|
<HeaderBase
|
|
|
|
startAccessory={
|
2023-04-04 18:48:04 +02:00
|
|
|
<Icon data-testid="start-accessory" name={IconName.AddSquare} />
|
2023-03-23 16:24:23 +01:00
|
|
|
}
|
|
|
|
/>,
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(getByTestId('start-accessory')).toBeDefined();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should render HeaderBase endAccessory', () => {
|
|
|
|
const { getByTestId } = render(
|
|
|
|
<HeaderBase
|
|
|
|
endAccessory={
|
2023-04-04 18:48:04 +02:00
|
|
|
<Icon data-testid="end-accessory" name={IconName.AddSquare} />
|
2023-03-23 16:24:23 +01:00
|
|
|
}
|
|
|
|
/>,
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(getByTestId('end-accessory')).toBeDefined();
|
|
|
|
});
|
|
|
|
});
|