mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 16:51:11 +03:00
d047bc876a
- Component conditionally renders based on # of virtual environments. - User can add an Organization and associate it with a virtual environment.
18 lines
813 B
JavaScript
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();
|
|
});
|
|
}); |