2015-11-30 16:54:39 +08:00
|
|
|
import React from 'react';
|
2016-06-22 22:31:00 +08:00
|
|
|
import TestUtils from 'react-addons-test-utils';
|
|
|
|
import { wrap } from 'react-stateless-wrapper';
|
2016-11-22 13:43:53 +08:00
|
|
|
import AntIcon from '../../components/icon/index';
|
2016-06-22 22:31:00 +08:00
|
|
|
const Icon = wrap(AntIcon);
|
2015-11-30 16:54:39 +08:00
|
|
|
|
2016-06-22 22:31:00 +08:00
|
|
|
describe('Icon', function() {
|
|
|
|
let icon;
|
|
|
|
let iconNode;
|
2015-11-30 16:54:39 +08:00
|
|
|
|
2016-06-22 22:31:00 +08:00
|
|
|
beforeEach(() => {
|
|
|
|
icon = TestUtils.renderIntoDocument(
|
|
|
|
<Icon type="appstore" className="my-icon-classname" />
|
|
|
|
);
|
|
|
|
iconNode = TestUtils.findRenderedDOMComponentWithTag(icon, 'I');
|
|
|
|
});
|
2015-11-30 16:54:39 +08:00
|
|
|
|
2016-06-22 22:31:00 +08:00
|
|
|
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');
|
|
|
|
});
|
2015-11-30 16:54:39 +08:00
|
|
|
});
|