2021-02-04 19:15:23 +01:00
|
|
|
import React from 'react';
|
|
|
|
import { shallow } from 'enzyme';
|
2021-03-16 22:00:08 +01:00
|
|
|
import ModalContent from './modal-content.component';
|
2018-09-19 23:30:52 +02:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
describe('ModalContent Component', () => {
|
|
|
|
it('should render a title', () => {
|
2021-02-04 19:15:23 +01:00
|
|
|
const wrapper = shallow(<ModalContent title="Modal Title" />);
|
2018-09-19 23:30:52 +02:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
expect(wrapper.find('.modal-content__title')).toHaveLength(1);
|
|
|
|
expect(wrapper.find('.modal-content__title').text()).toStrictEqual(
|
2020-12-03 16:46:22 +01:00
|
|
|
'Modal Title',
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2021-04-15 20:01:46 +02:00
|
|
|
expect(wrapper.find('.modal-content__description')).toHaveLength(0);
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
2018-09-19 23:30:52 +02:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
it('should render a description', () => {
|
2021-02-04 19:15:23 +01:00
|
|
|
const wrapper = shallow(<ModalContent description="Modal Description" />);
|
2018-09-19 23:30:52 +02:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
expect(wrapper.find('.modal-content__title')).toHaveLength(0);
|
|
|
|
expect(wrapper.find('.modal-content__description')).toHaveLength(1);
|
|
|
|
expect(wrapper.find('.modal-content__description').text()).toStrictEqual(
|
2020-11-03 00:41:28 +01:00
|
|
|
'Modal Description',
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
|
|
|
});
|
2018-09-19 23:30:52 +02:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
it('should render both a title and a description', () => {
|
2018-09-19 23:30:52 +02:00
|
|
|
const wrapper = shallow(
|
2020-11-03 00:41:28 +01:00
|
|
|
<ModalContent title="Modal Title" description="Modal Description" />,
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2018-09-19 23:30:52 +02:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
expect(wrapper.find('.modal-content__title')).toHaveLength(1);
|
|
|
|
expect(wrapper.find('.modal-content__title').text()).toStrictEqual(
|
2020-12-03 16:46:22 +01:00
|
|
|
'Modal Title',
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2021-04-15 20:01:46 +02:00
|
|
|
expect(wrapper.find('.modal-content__description')).toHaveLength(1);
|
|
|
|
expect(wrapper.find('.modal-content__description').text()).toStrictEqual(
|
2020-11-03 00:41:28 +01:00
|
|
|
'Modal Description',
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|