1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-30 16:18:07 +01:00
metamask-extension/ui/components/app/modal/modal-content/modal-content.component.test.js

41 lines
1.4 KiB
JavaScript
Raw Normal View History

import React from 'react';
import { shallow } from 'enzyme';
import ModalContent from './modal-content.component';
2018-09-19 23:30:52 +02:00
describe('ModalContent Component', () => {
it('should render a title', () => {
const wrapper = shallow(<ModalContent title="Modal Title" />);
2018-09-19 23:30:52 +02:00
expect(wrapper.find('.modal-content__title')).toHaveLength(1);
expect(wrapper.find('.modal-content__title').text()).toStrictEqual(
'Modal Title',
);
expect(wrapper.find('.modal-content__description')).toHaveLength(0);
});
2018-09-19 23:30:52 +02:00
it('should render a description', () => {
const wrapper = shallow(<ModalContent description="Modal Description" />);
2018-09-19 23:30:52 +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',
);
});
2018-09-19 23:30:52 +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" />,
);
2018-09-19 23:30:52 +02:00
expect(wrapper.find('.modal-content__title')).toHaveLength(1);
expect(wrapper.find('.modal-content__title').text()).toStrictEqual(
'Modal Title',
);
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',
);
});
});