2019-09-08 15:08:21 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { mount } from 'enzyme';
|
|
|
|
import RadioButton from '.';
|
|
|
|
|
2019-12-03 12:39:07 +00:00
|
|
|
const baseProps = {
|
|
|
|
name: 'fruits',
|
|
|
|
value: 'apple',
|
|
|
|
label: 'Sweet apple'
|
|
|
|
};
|
|
|
|
|
2019-09-08 15:08:21 +00:00
|
|
|
describe('<RadioButton />', () => {
|
|
|
|
it('renders without error', () => {
|
|
|
|
const wrapper = mount(
|
2019-12-03 12:39:07 +00:00
|
|
|
<RadioButton {...baseProps} />
|
2019-09-08 15:08:21 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
expect(wrapper).toExist();
|
|
|
|
});
|
2019-12-03 12:39:07 +00:00
|
|
|
|
|
|
|
it('accepts id', () => {
|
|
|
|
const wrapper = mount(
|
|
|
|
<RadioButton {...baseProps} id="testId" />
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(wrapper.prop('id')).toEqual('testId');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('accepts className', () => {
|
|
|
|
const wrapper = mount(
|
|
|
|
<RadioButton {...baseProps} className="test" />
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(wrapper.prop('className')).toEqual('test');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('accepts style', () => {
|
|
|
|
const wrapper = mount(
|
|
|
|
<RadioButton {...baseProps} style={{ color: 'red' }} />
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(wrapper.getDOMNode().style).toHaveProperty('color', 'red');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('accepts isDisabled prop', () => {
|
|
|
|
const wrapper = mount(
|
|
|
|
<RadioButton {...baseProps} isDisabled />
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(wrapper.prop('isDisabled')).toEqual(true);
|
|
|
|
});
|
2019-09-08 15:08:21 +00:00
|
|
|
});
|