diff --git a/components/badge/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/badge/__tests__/__snapshots__/demo-extend.test.ts.snap index 19d2e76679..37ecfb793b 100644 --- a/components/badge/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/badge/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -1332,6 +1332,78 @@ Array [ style="background:#fa541c" /> , + + + 0 + + , + + + 0 + + , + + + 0 + + , + + + + + + 0 + + , + + + + + + 0 + + , ] `; @@ -1357,6 +1429,42 @@ exports[`renders ./components/badge/demo/no-wrapper.md extend context correctly /> +
+ + + + + 1 + + + + + 1 + + + + +
, + + + 0 + + , + + + 0 + + , + + + 0 + + , + + + + + + 0 + + , + + + + + + 0 + + , ] `; @@ -1357,6 +1429,42 @@ exports[`renders ./components/badge/demo/no-wrapper.md correctly 1`] = ` />
+
+ + + + + 1 + + + + + 1 + + + + +
+ + + 0 + + + + + 0 + + + + + 0 + + + +
+ children +
+ + 0 + +
+
+`; + exports[`Badge render Badge status/color when contains children 1`] = `
{ expect(container.querySelectorAll('.ant-badge > .ant-badge-status-text')).toHaveLength(0); }); + + // https://github.com/ant-design/ant-design/issues/38965 + it('Badge should display 0 when count is 0', () => { + const { container } = render( + <> + + + + +
children
+
+ , + ); + + expect(container).toMatchSnapshot(); + expect(container.querySelectorAll('[title="0"]')).toHaveLength(4); + }); }); diff --git a/components/badge/demo/mix.md b/components/badge/demo/mix.md index 1e494a71cb..57fe42ff37 100644 --- a/components/badge/demo/mix.md +++ b/components/badge/demo/mix.md @@ -44,6 +44,15 @@ const App: React.FC = () => ( + + + + + + + + + ); diff --git a/components/badge/demo/no-wrapper.md b/components/badge/demo/no-wrapper.md index 3ba8cadac3..0b0d188adb 100644 --- a/components/badge/demo/no-wrapper.md +++ b/components/badge/demo/no-wrapper.md @@ -26,6 +26,7 @@ const App: React.FC = () => { return ( setShow(!show)} /> + : 0} />