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

View File

@ -209,6 +209,46 @@ exports[`Descriptions column is number 1`] = `
</div> </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`] = ` exports[`Descriptions should work with React Fragment 1`] = `
<div <div
class="ant-descriptions" class="ant-descriptions"

View File

@ -238,4 +238,15 @@ describe('Descriptions', () => {
wrapper.setProps({ extra: undefined }); wrapper.setProps({ extra: undefined });
expect(wrapper.find('.ant-descriptions-extra').exists()).toBe(false); 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 // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Spin if indicator set null should not be render default indicator 1`] = ` exports[`Spin if indicator set null should not be render default indicator 1`] = `
<Spin <div
indicator={null} class="ant-spin ant-spin-spinning"
size="default" />
spinning={true}
wrapperClassName=""
>
<div
aria-busy={true}
aria-live="polite"
className="ant-spin ant-spin-spinning"
/>
</Spin>
`; `;
exports[`Spin rtl render component should be rendered correctly in RTL direction 1`] = ` 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`] = ` exports[`Spin should support static method Spin.setDefaultIndicator 1`] = `
<Spin <div
size="default" class="ant-spin ant-spin-spinning"
spinning={true}
wrapperClassName=""
> >
<div <em
aria-busy={true} class="custom-spinner ant-spin-dot"
aria-live="polite" />
className="ant-spin ant-spin-spinning" </div>
>
<em
className="custom-spinner ant-spin-dot"
/>
</div>
</Spin>
`; `;

View File

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