From 01305bde86e020a8fed628129b0ac29af97cebea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Fri, 13 Feb 2026 11:11:24 +0800 Subject: [PATCH] fix: handle number 0 as valid label in SingleContent - Fix logic bug where number 0 was incorrectly excluded from has-value className - Update condition to explicitly check null, undefined, and empty string - Add test case for number 0 value display --- src/SelectInput/Content/SingleContent.tsx | 6 +++++- tests/Select.test.tsx | 10 ++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/SelectInput/Content/SingleContent.tsx b/src/SelectInput/Content/SingleContent.tsx index 89e6b747..55008591 100644 --- a/src/SelectInput/Content/SingleContent.tsx +++ b/src/SelectInput/Content/SingleContent.tsx @@ -88,7 +88,11 @@ const SingleContent = React.forwardRef(
{ expect(container.querySelector('.rc-select-content-has-value')).toBeFalsy(); }); + it('should add -content-has-value className when value is number 0', () => { + const { container } = render( + , + ); + expect(container.querySelector('.rc-select-content-has-value')).toBeTruthy(); + }); + it('should default select the right option', () => { const { container } = render(