mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 12:09:14 +08:00
fix: null value tooltip (#22482)
This commit is contained in:
parent
66e53fb91d
commit
4e270e1873
@ -87,4 +87,10 @@ describe('Slider', () => {
|
||||
await sleep(20);
|
||||
expect(wrapper.find('Tooltip').instance().tooltip.forcePopupAlign).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('tipFormatter should not crash with undefined value', () => {
|
||||
[undefined, null].forEach(value => {
|
||||
mount(<Slider value={value} tooltipVisible />);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -64,7 +64,7 @@ export interface SliderState {
|
||||
export default class Slider extends React.Component<SliderProps, SliderState> {
|
||||
static defaultProps = {
|
||||
tipFormatter(value: number) {
|
||||
return value.toString();
|
||||
return typeof value === 'number' ? value.toString() : '';
|
||||
},
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user