2016-12-14 14:48:09 +08:00
|
|
|
import React from 'react';
|
2017-04-12 20:49:02 +08:00
|
|
|
import TestUtils from 'react-dom/test-utils';
|
2017-05-18 14:22:47 +08:00
|
|
|
import Icon from '..';
|
2016-12-14 14:48:09 +08:00
|
|
|
|
2017-05-18 14:22:47 +08:00
|
|
|
class Wrapper extends React.Component {
|
|
|
|
render() {
|
|
|
|
return this.props.children;
|
|
|
|
}
|
|
|
|
}
|
2016-12-14 14:48:09 +08:00
|
|
|
|
|
|
|
describe('Icon', () => {
|
|
|
|
let icon;
|
|
|
|
let iconNode;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
icon = TestUtils.renderIntoDocument(
|
2017-05-18 14:22:47 +08:00
|
|
|
<Wrapper><Icon type="appstore" className="my-icon-classname" /></Wrapper>
|
2016-12-14 14:48:09 +08:00
|
|
|
);
|
|
|
|
iconNode = TestUtils.findRenderedDOMComponentWithTag(icon, 'I');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should render to a <i class="xxx"></i>', () => {
|
|
|
|
expect(iconNode.tagName).toBe('I');
|
|
|
|
expect(iconNode.className).toContain('my-icon-classname');
|
|
|
|
expect(iconNode.className).toContain('anticon');
|
|
|
|
expect(iconNode.className).toContain('anticon-appstore');
|
|
|
|
});
|
|
|
|
});
|