diff --git a/src/SelectInput/Content/SingleContent.tsx b/src/SelectInput/Content/SingleContent.tsx index 55008591..6a44357f 100644 --- a/src/SelectInput/Content/SingleContent.tsx +++ b/src/SelectInput/Content/SingleContent.tsx @@ -63,6 +63,12 @@ const SingleContent = React.forwardRef( }, [combobox, activeValue]); // ========================== Render ========================== + const showHasValueCls = + displayValue && + displayValue.label !== null && + displayValue.label !== undefined && + String(displayValue.label).trim() !== ''; + // Render value const renderValue = displayValue ? ( hasOptionStyle ? ( @@ -88,11 +94,7 @@ const SingleContent = React.forwardRef(
{ const { container } = render( , ); expect(container.querySelector('.rc-select-content-has-value')).toBeTruthy(); }); + it('should not add -content-has-value className when value is whitespace string', () => { + const { container } = render( + , + ); + expect(container.querySelector('.rc-select-content-has-value')).toBeFalsy(); + }); + it('should default select the right option', () => { const { container } = render(