You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.4 KiB
41 lines
1.4 KiB
4 years ago
|
import React from 'react';
|
||
|
import { shallow } from 'enzyme';
|
||
4 years ago
|
import ModalContent from './modal-content.component';
|
||
6 years ago
|
|
||
4 years ago
|
describe('ModalContent Component', () => {
|
||
|
it('should render a title', () => {
|
||
4 years ago
|
const wrapper = shallow(<ModalContent title="Modal Title" />);
|
||
6 years ago
|
|
||
4 years ago
|
expect(wrapper.find('.modal-content__title')).toHaveLength(1);
|
||
|
expect(wrapper.find('.modal-content__title').text()).toStrictEqual(
|
||
4 years ago
|
'Modal Title',
|
||
4 years ago
|
);
|
||
4 years ago
|
expect(wrapper.find('.modal-content__description')).toHaveLength(0);
|
||
4 years ago
|
});
|
||
6 years ago
|
|
||
4 years ago
|
it('should render a description', () => {
|
||
4 years ago
|
const wrapper = shallow(<ModalContent description="Modal Description" />);
|
||
6 years ago
|
|
||
4 years ago
|
expect(wrapper.find('.modal-content__title')).toHaveLength(0);
|
||
|
expect(wrapper.find('.modal-content__description')).toHaveLength(1);
|
||
|
expect(wrapper.find('.modal-content__description').text()).toStrictEqual(
|
||
4 years ago
|
'Modal Description',
|
||
4 years ago
|
);
|
||
|
});
|
||
6 years ago
|
|
||
4 years ago
|
it('should render both a title and a description', () => {
|
||
6 years ago
|
const wrapper = shallow(
|
||
4 years ago
|
<ModalContent title="Modal Title" description="Modal Description" />,
|
||
4 years ago
|
);
|
||
6 years ago
|
|
||
4 years ago
|
expect(wrapper.find('.modal-content__title')).toHaveLength(1);
|
||
|
expect(wrapper.find('.modal-content__title').text()).toStrictEqual(
|
||
4 years ago
|
'Modal Title',
|
||
4 years ago
|
);
|
||
4 years ago
|
expect(wrapper.find('.modal-content__description')).toHaveLength(1);
|
||
|
expect(wrapper.find('.modal-content__description').text()).toStrictEqual(
|
||
4 years ago
|
'Modal Description',
|
||
4 years ago
|
);
|
||
|
});
|
||
|
});
|