diff --git a/src/Panel.tsx b/src/Panel.tsx index 09a57b4..d831507 100644 --- a/src/Panel.tsx +++ b/src/Panel.tsx @@ -4,7 +4,7 @@ import classNames from 'classnames'; import CSSMotion from 'rc-motion'; import shallowEqual from 'shallowequal'; import PanelContent from './PanelContent'; -import { CollapsePanelProps } from './interface'; +import type { CollapsePanelProps } from './interface'; class CollapsePanel extends React.Component { static defaultProps = { @@ -73,6 +73,8 @@ class CollapsePanel extends React.Component { icon = expandIcon(this.props); } + const ifExtraExist = extra !== null && extra !== undefined && typeof extra !== 'boolean'; + return (
{ ) : ( header )} - {extra &&
{extra}
} + {ifExtraExist &&
{extra}
}
{ runNormalTest(element); }); + + describe('it shoule support extra whit number 0', () => { + const collapse = mount( + + + zero + + , + ); + + const extraNodes = collapse.find('.rc-collapse-extra'); + expect(extraNodes.length).toBe(1); + expect(extraNodes.at(0).getDOMNode().innerHTML).toBe('0'); + }); + describe('it should support activeKey number 0', () => { const collapse = mount( diff --git a/tsconfig.json b/tsconfig.json index 4c0fed6..e7bd793 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,4 +13,4 @@ "rc-collapse": ["src/index.tsx"] } } -} \ No newline at end of file +}