diff --git a/src/components/virtual-input/tests/virtual-input.test.tsx b/src/components/virtual-input/tests/virtual-input.test.tsx index 5e12b35674..0cd11daab9 100644 --- a/src/components/virtual-input/tests/virtual-input.test.tsx +++ b/src/components/virtual-input/tests/virtual-input.test.tsx @@ -108,4 +108,9 @@ describe('VirtualInput', () => { ).not.toBeVisible() }) }) + + test('placeholder should not be shown when value is `0`', () => { + render() + expect(screen.queryByText('placeholder')).toBeNull() + }) }) diff --git a/src/components/virtual-input/virtual-input.tsx b/src/components/virtual-input/virtual-input.tsx index 6e764320b9..11751f9fc0 100644 --- a/src/components/virtual-input/virtual-input.tsx +++ b/src/components/virtual-input/virtual-input.tsx @@ -151,7 +151,7 @@ export const VirtualInput = forwardRef( )} - {!value && ( + {[undefined, null, ''].includes(value) && (
{props.placeholder}