import * as React from 'react';
import { shallow } from 'enzyme';
import IconCheckbox from './IconCheckbox';
import YellowStar from '../../../svg/star--yellow.svg';

import TestComponentPropUtils from '../../../utils/TestComponentPropUtils';

describe('Checkbox', () => {
	it('renders without crashing', () => {
		shallow(<IconCheckbox onChange={() => null} Icon={YellowStar} />);
	});

	it('renders basic react props like id, className, and style as element attributes', () => {
		const shallowWrapper = shallow(<IconCheckbox onChange={() => null} Icon={YellowStar} {...TestComponentPropUtils.basicReactProps} />);

		expect(shallowWrapper.props().style.cursor).toBe('pointer');
		expect(shallowWrapper.props().className).toContain('myClass');
	});

	it('renders name attribute correctly', () => {
		const component = shallow(<IconCheckbox name="FormName" onChange={() => null} Icon={YellowStar} />);
		expect(component.exists('[name="FormName"]')).toBe(true);
	});
});
