From c2bcf44f62a9b260c0846430137477a41f225562 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 7 Sep 2019 19:42:04 +0800 Subject: [PATCH] :lipstick: should not insert space to link button close #18118 --- .../button/__tests__/__snapshots__/index.test.js.snap | 11 +++++++++++ components/button/__tests__/index.test.js | 6 ++++++ components/button/button.tsx | 4 ++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/components/button/__tests__/__snapshots__/index.test.js.snap b/components/button/__tests__/__snapshots__/index.test.js.snap index 9206286b7d..7d6028c709 100644 --- a/components/button/__tests__/__snapshots__/index.test.js.snap +++ b/components/button/__tests__/__snapshots__/index.test.js.snap @@ -222,6 +222,17 @@ exports[`Button should merge text if children using variable 1`] = ` `; +exports[`Button should not insert space to link button 1`] = ` + +`; + exports[`Button should not render as link button when href is undefined 1`] = ` ); + expect(wrapper).toMatchSnapshot(); + }); + it('have static property for type detecting', () => { const wrapper = mount(); // eslint-disable-next-line diff --git a/components/button/button.tsx b/components/button/button.tsx index fd423eb218..be9c1b46b4 100644 --- a/components/button/button.tsx +++ b/components/button/button.tsx @@ -217,8 +217,8 @@ class Button extends React.Component { } isNeedInserted() { - const { icon, children } = this.props; - return React.Children.count(children) === 1 && !icon; + const { icon, children, type } = this.props; + return React.Children.count(children) === 1 && !icon && type !== 'link'; } renderButton = ({ getPrefixCls, autoInsertSpaceInButton }: ConfigConsumerProps) => {