1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 16:51:11 +03:00
awx/__tests__/components/About.test.jsx

32 lines
851 B
React
Raw Normal View History

2018-11-03 00:46:43 +03:00
import React from 'react';
import { mount } from 'enzyme';
2018-12-10 18:16:52 +03:00
import { I18nProvider } from '@lingui/react';
2018-11-03 00:46:43 +03:00
import About from '../../src/components/About';
describe('<About />', () => {
2018-11-16 08:13:25 +03:00
let aboutWrapper;
let closeButton;
const onClose = jest.fn();
2018-11-03 00:46:43 +03:00
test('initially renders without crashing', () => {
2018-12-10 18:16:52 +03:00
aboutWrapper = mount(
<I18nProvider>
<About isOpen onClose={onClose} />
2018-12-10 18:16:52 +03:00
</I18nProvider>
);
2018-11-03 00:46:43 +03:00
expect(aboutWrapper.length).toBe(1);
2018-11-16 08:13:25 +03:00
aboutWrapper.unmount();
});
test('close button calls onClose handler', () => {
2018-12-10 18:16:52 +03:00
aboutWrapper = mount(
<I18nProvider>
<About isOpen onClose={onClose} />
2018-12-10 18:16:52 +03:00
</I18nProvider>
);
2018-11-16 08:13:25 +03:00
closeButton = aboutWrapper.find('AboutModalBoxCloseButton Button');
closeButton.simulate('click');
expect(onClose).toBeCalled();
2018-11-16 08:13:25 +03:00
aboutWrapper.unmount();
});
2018-11-03 00:46:43 +03:00
});