mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-07 09:26:06 +08:00
feat(Empty): description prop support false value to remove description node
This commit is contained in:
parent
9d437d39f9
commit
fab98738f4
@ -8,8 +8,8 @@ describe('Empty', () => {
|
||||
expect(wrapper.find('.ant-empty-image').props().style.height).toBe(20);
|
||||
});
|
||||
|
||||
it('description can be undefined or null', () => {
|
||||
const wrapper = mount(<Empty description={undefined} />);
|
||||
it('description can be false', () => {
|
||||
const wrapper = mount(<Empty description={false} />);
|
||||
expect(wrapper.find('.ant-empty-description').length).toBe(0);
|
||||
});
|
||||
});
|
||||
|
@ -16,5 +16,5 @@ Simplest Usage with no description.
|
||||
```jsx
|
||||
import { Empty } from 'antd';
|
||||
|
||||
ReactDOM.render(<Empty description={undefined} />, mountNode);
|
||||
ReactDOM.render(<Empty description={false} />, mountNode);
|
||||
```
|
||||
|
@ -39,7 +39,7 @@ const OriginEmpty: React.SFC<EmptyProps> = (props: EmptyProps) => (
|
||||
<LocaleReceiver componentName="Empty">
|
||||
{(locale: TransferLocale) => {
|
||||
const prefixCls = getPrefixCls('empty', customizePrefixCls);
|
||||
const des = description == null ? description : (description || locale.description);
|
||||
const des = typeof description !== 'undefined' ? description : (description || locale.description);
|
||||
const alt = typeof des === 'string' ? des : 'empty';
|
||||
|
||||
let imageNode: React.ReactNode = null;
|
||||
|
Loading…
Reference in New Issue
Block a user