import {shallow} from 'enzyme';
import React from 'react';
import {Icon} from 'src/components/Icon';
describe('src/components/Icon', () => {
const FakeIcon = (props) => { // eslint-disable-line no-unused-vars
return It works!;
};
it('allows passing an arbitrary class name', () => {
const component = shallow(
);
expect(component.hasClass('test')).toBe(true);
});
it('allows specifying the size', () => {
const component = shallow(
);
const style = component.prop('style');
expect(style.height).toEqual('16px');
expect(style.width).toEqual('16px');
});
it('defaults size to 1em if not specified', () => {
const component = shallow(
);
const style = component.prop('style');
expect(style.height).toEqual('1em');
expect(style.width).toEqual('1em');
});
it('allows setting vertical align to middle', () => {
const component = shallow(
);
const style = component.prop('style');
expect(style.verticalAlign).toEqual('middle');
});
it('allows specifying a title', () => {
const component = shallow(
);
expect(component.prop('title')).toEqual('Test');
});
it('renders the element passed in the icon prop', () => {
const component = shallow(
);
expect(component.find(FakeIcon).exists()).toBe(true);
});
});