mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-04 04:58:55 +08:00
parent
cf97324abd
commit
c2bcf44f62
@ -222,6 +222,17 @@ exports[`Button should merge text if children using variable 1`] = `
|
|||||||
</button>
|
</button>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`Button should not insert space to link button 1`] = `
|
||||||
|
<button
|
||||||
|
class="ant-btn ant-btn-link"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<span>
|
||||||
|
按钮
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`Button should not render as link button when href is undefined 1`] = `
|
exports[`Button should not render as link button when href is undefined 1`] = `
|
||||||
<button
|
<button
|
||||||
class="ant-btn ant-btn-primary"
|
class="ant-btn ant-btn-primary"
|
||||||
|
@ -70,6 +70,12 @@ describe('Button', () => {
|
|||||||
expect(wrapper.find('.ant-btn').hasClass('ant-btn-two-chinese-chars')).toBe(true);
|
expect(wrapper.find('.ant-btn').hasClass('ant-btn-two-chinese-chars')).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// https://github.com/ant-design/ant-design/issues/18118
|
||||||
|
it('should not insert space to link button', () => {
|
||||||
|
const wrapper = render(<Button type="link">按钮</Button>);
|
||||||
|
expect(wrapper).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
|
||||||
it('have static property for type detecting', () => {
|
it('have static property for type detecting', () => {
|
||||||
const wrapper = mount(<Button>Button Text</Button>);
|
const wrapper = mount(<Button>Button Text</Button>);
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
|
@ -217,8 +217,8 @@ class Button extends React.Component<ButtonProps, ButtonState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
isNeedInserted() {
|
isNeedInserted() {
|
||||||
const { icon, children } = this.props;
|
const { icon, children, type } = this.props;
|
||||||
return React.Children.count(children) === 1 && !icon;
|
return React.Children.count(children) === 1 && !icon && type !== 'link';
|
||||||
}
|
}
|
||||||
|
|
||||||
renderButton = ({ getPrefixCls, autoInsertSpaceInButton }: ConfigConsumerProps) => {
|
renderButton = ({ getPrefixCls, autoInsertSpaceInButton }: ConfigConsumerProps) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user