1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 16:51:11 +03:00
awx/__tests__/components/AnsibleEnvironmentSelect.test.jsx
kialam d047bc876a
Basic Ansible Environment Select Component
- Component conditionally renders based on # of virtual environments.
- User can add an Organization and associate it with a virtual environment.
2018-12-10 20:41:47 -05:00

18 lines
813 B
JavaScript

import React from 'react';
import { mount } from 'enzyme';
import AnsibleEnvironmentSelect from '../../src/components/AnsibleEnvironmentSelect';
describe('<AnsibleEnvironmentSelect />', () => {
test('initially renders succesfully', async() => {
const wrapper = mount(<AnsibleEnvironmentSelect selected="foo" selectChange={() => {}} />);
wrapper.setState({ isHidden: false });
});
test('calls "onSelectChange" on dropdown select change', () => {
const spy = jest.spyOn(AnsibleEnvironmentSelect.prototype, 'onSelectChange');
const wrapper = mount(<AnsibleEnvironmentSelect selected="foo" selectChange={() => {}} />);
wrapper.setState({ isHidden: false });
expect(spy).not.toHaveBeenCalled();
wrapper.find('select').simulate('change');
expect(spy).toHaveBeenCalled();
});
});