mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 16:51:11 +03:00
18 lines
813 B
React
18 lines
813 B
React
|
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();
|
||
|
});
|
||
|
});
|