import React from 'react'; import {mount, shallow} from 'enzyme'; import RadioGroup from 'app/views/settings/components/forms/controls/radioGroup'; describe('RadioGroup', function() { describe('render()', function() { it('renders', function() { const wrapper = shallow( ); expect(wrapper).toMatchSnapshot(); }); it('renders disabled', function() { const wrapper = mount( ); expect(wrapper).toMatchSnapshot(); expect(wrapper.find('RadioLineText').props().disabled).toBe(true); expect(wrapper.find('RadioLineButtonFill').props().disabled).toBe(true); }); it('can select a different item', function() { const wrapper = shallow( ); expect(wrapper).toMatchSnapshot(); }); it('calls onChange when clicked', function() { const mock = jest.fn(); const wrapper = mount( ); wrapper .find('[role="radio"]') .last() .simulate('click'); expect(mock).toHaveBeenCalledWith(expect.any(String), expect.any(Object)); }); }); });