chore: next merge master

This commit is contained in:
zombiej 2022-03-25 10:06:06 +08:00
commit 8d04e4c1a1
5 changed files with 64 additions and 30 deletions

View File

@ -60,7 +60,7 @@ const Cell: React.FC<CellProps> = ({
colSpan={span}
>
<div className={`${itemPrefixCls}-item-container`}>
{label && (
{(label || label === 0) && (
<span
className={classNames(`${itemPrefixCls}-item-label`, {
[`${itemPrefixCls}-item-no-colon`]: !colon,
@ -70,7 +70,7 @@ const Cell: React.FC<CellProps> = ({
{label}
</span>
)}
{content && (
{(content || content === 0) && (
<span className={classNames(`${itemPrefixCls}-item-content`)} style={contentStyle}>
{content}
</span>

View File

@ -209,6 +209,46 @@ exports[`Descriptions column is number 1`] = `
</div>
`;
exports[`Descriptions number 0 should render correct 1`] = `
<div
class="ant-descriptions"
>
<div
class="ant-descriptions-view"
>
<table>
<tbody>
<tr
class="ant-descriptions-row"
>
<td
class="ant-descriptions-item"
colspan="1"
>
<div
class="ant-descriptions-item-container"
>
<span
class="ant-descriptions-item-label"
style="color: red;"
>
0
</span>
<span
class="ant-descriptions-item-content"
style="color: red;"
>
0
</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
`;
exports[`Descriptions should work with React Fragment 1`] = `
<div
class="ant-descriptions"

View File

@ -238,4 +238,15 @@ describe('Descriptions', () => {
wrapper.setProps({ extra: undefined });
expect(wrapper.find('.ant-descriptions-extra').exists()).toBe(false);
});
it('number 0 should render correct', () => {
const wrapper = mount(
<Descriptions>
<Descriptions.Item label={0} labelStyle={{ color: 'red' }} contentStyle={{ color: 'red' }}>
{0}
</Descriptions.Item>
</Descriptions>,
);
expect(wrapper.render()).toMatchSnapshot();
});
});

View File

@ -1,18 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Spin if indicator set null should not be render default indicator 1`] = `
<Spin
indicator={null}
size="default"
spinning={true}
wrapperClassName=""
>
<div
aria-busy={true}
aria-live="polite"
className="ant-spin ant-spin-spinning"
/>
</Spin>
<div
class="ant-spin ant-spin-spinning"
/>
`;
exports[`Spin rtl render component should be rendered correctly in RTL direction 1`] = `
@ -53,19 +44,11 @@ exports[`Spin should render custom indicator when it's set 1`] = `
`;
exports[`Spin should support static method Spin.setDefaultIndicator 1`] = `
<Spin
size="default"
spinning={true}
wrapperClassName=""
<div
class="ant-spin ant-spin-spinning"
>
<div
aria-busy={true}
aria-live="polite"
className="ant-spin ant-spin-spinning"
>
<em
className="custom-spinner ant-spin-dot"
class="custom-spinner ant-spin-dot"
/>
</div>
</Spin>
</div>
`;

View File

@ -33,13 +33,13 @@ describe('Spin', () => {
it('if indicator set null should not be render default indicator', () => {
const wrapper = mount(<Spin indicator={null} />);
expect(wrapper).toMatchSnapshot();
expect(wrapper.render()).toMatchSnapshot();
});
it('should support static method Spin.setDefaultIndicator', () => {
Spin.setDefaultIndicator(<em className="custom-spinner" />);
const wrapper = mount(<Spin />);
expect(wrapper).toMatchSnapshot();
expect(wrapper.render()).toMatchSnapshot();
Spin.setDefaultIndicator(null);
});