diff --git a/components/badge/__tests__/index.test.js b/components/badge/__tests__/index.test.js index 205250f49b..4ab639de5b 100644 --- a/components/badge/__tests__/index.test.js +++ b/components/badge/__tests__/index.test.js @@ -155,19 +155,6 @@ describe('Badge', () => { expect(wrapper.find('.ant-badge')).toHaveLength(2); }); - - it('Badge should work when status changes', () => { - const wrapper = mount( - - - , - ); - wrapper.setProps({ status: undefined }); - - expect(wrapper.find('.ant-badge-count')).toHaveLength(0); - expect(wrapper.find('.ant-badge-dot')).toHaveLength(0); - expect(wrapper.find('.ant-badge-count-sm')).toHaveLength(0); - }); }); describe('Ribbon', () => { diff --git a/components/badge/index.tsx b/components/badge/index.tsx index 578f11d1a8..c91dbb4f9c 100644 --- a/components/badge/index.tsx +++ b/components/badge/index.tsx @@ -94,8 +94,6 @@ const Badge: CompoundedComponent = ({ const isDotRef = useRef(showAsDot); if (!isHidden) { isDotRef.current = showAsDot; - } else { - isDotRef.current = false; } // =============================== Styles =============================== @@ -188,8 +186,8 @@ const Badge: CompoundedComponent = ({ const scrollNumberCls = classNames({ [`${prefixCls}-dot`]: isDot, - [`${prefixCls}-count`]: !isDot && !isHidden, - [`${prefixCls}-count-sm`]: !isDot && !isHidden && size === 'small', + [`${prefixCls}-count`]: !isDot, + [`${prefixCls}-count-sm`]: size === 'small', [`${prefixCls}-multiple-words`]: !isDot && displayCount && displayCount.toString().length > 1, [`${prefixCls}-status-${status}`]: !!status,