Release 1.3.0

This commit is contained in:
2021-08-26 12:33:15 +02:00
commit 9bb72f0207
1148 changed files with 92133 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
require('tests/__setup__/enzyme.setup.js');
let testsContext = require.context('.', true, /\.spec\.js$/);
testsContext.keys().forEach(testsContext);

View File

@@ -0,0 +1,7 @@
import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
Enzyme.configure({
adapter: new Adapter(),
disableLifecycleMethods: true,
});

View File

@@ -0,0 +1,60 @@
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 <span>It works!</span>;
};
it('allows passing an arbitrary class name', () => {
const component = shallow(
<Icon className="test" icon={FakeIcon} />
);
expect(component.hasClass('test')).toBe(true);
});
it('allows specifying the size', () => {
const component = shallow(
<Icon icon={FakeIcon} size="16px" />
);
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(
<Icon icon={FakeIcon} />
);
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(
<Icon icon={FakeIcon} middle />
);
const style = component.prop('style');
expect(style.verticalAlign).toEqual('middle');
});
it('allows specifying a title', () => {
const component = shallow(
<Icon icon={FakeIcon} title="Test" />
);
expect(component.prop('title')).toEqual('Test');
});
it('renders the element passed in the icon prop', () => {
const component = shallow(
<Icon icon={FakeIcon} />
);
expect(component.find(FakeIcon).exists()).toBe(true);
});
});