fix: Spin render 0 (#27839)

This commit is contained in:
liuchao233 2020-11-18 11:59:29 +08:00 committed by GitHub
parent 30372ffad3
commit c04e51048d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -42,4 +42,11 @@ describe('Spin', () => {
expect(wrapper).toMatchSnapshot();
Spin.setDefaultIndicator(null);
});
it('should render 0', () => {
const wrapper = mount(
<Spin>{0}</Spin>,
);
expect(wrapper.find('.ant-spin-container').at(0).text()).toBe('0');
});
});

View File

@ -127,7 +127,7 @@ class Spin extends React.Component<SpinProps, SpinState> {
}
isNestedPattern() {
return !!(this.props && this.props.children);
return !!(this.props && typeof this.props.children !== 'undefined');
}
renderSpin = ({ getPrefixCls, direction }: ConfigConsumerProps) => {