diff --git a/components/icon/__tests__/__snapshots__/index.test.js.snap b/components/icon/__tests__/__snapshots__/index.test.js.snap
index 3f374700bd..325441a7cd 100644
--- a/components/icon/__tests__/__snapshots__/index.test.js.snap
+++ b/components/icon/__tests__/__snapshots__/index.test.js.snap
@@ -333,6 +333,20 @@ exports[`Icon should support two-tone icon 1`] = `
`;
+exports[`Icon support render svg as component 1`] = `
+
+
+
+`;
+
exports[`Icon.createFromIconfontCN() should support iconfont.cn 1`] = `
{
}).not.toThrow();
});
+ it('support render svg as component', () => {
+ const renderSvg = () => (
+
+ );
+ const SvgIcon = props => ;
+
+ expect(mount().render()).toMatchSnapshot();
+ });
+
describe('warning on conflicting theme', () => {
let errorSpy;
beforeEach(() => {
diff --git a/components/icon/index.tsx b/components/icon/index.tsx
index 59567a2808..caa214d6e4 100755
--- a/components/icon/index.tsx
+++ b/components/icon/index.tsx
@@ -121,6 +121,10 @@ const Icon: IconComponent = props => {
viewBox,
};
+ if (!viewBox) {
+ delete innerSvgProps.viewBox;
+ }
+
// component > children > type
if (Component) {
innerNode = {children};