mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 20:19:44 +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);
|
await sleep(20);
|
||||||
expect(wrapper.find('Tooltip').instance().tooltip.forcePopupAlign).toHaveBeenCalled();
|
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> {
|
export default class Slider extends React.Component<SliderProps, SliderState> {
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
tipFormatter(value: number) {
|
tipFormatter(value: number) {
|
||||||
return value.toString();
|
return typeof value === 'number' ? value.toString() : '';
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user