diff --git a/packages/components/src/combobox-control/index.tsx b/packages/components/src/combobox-control/index.tsx index fc3ecccf0b6599..cb05fdc2e4d358 100644 --- a/packages/components/src/combobox-control/index.tsx +++ b/packages/components/src/combobox-control/index.tsx @@ -241,9 +241,6 @@ function ComboboxControl( props: ComboboxControlProps ) { if ( expandOnFocus ) { setIsExpanded( true ); } - - onFilterValueChange( '' ); - setInputValue( '' ); }; const onClick = () => { diff --git a/packages/components/src/combobox-control/test/index.tsx b/packages/components/src/combobox-control/test/index.tsx index adc76590c24538..151ec99edfc5de 100644 --- a/packages/components/src/combobox-control/test/index.tsx +++ b/packages/components/src/combobox-control/test/index.tsx @@ -188,6 +188,26 @@ describe.each( [ expect( input ).toHaveValue( targetOption.label ); } ); + it( 'calls onFilterValueChange whenever the textbox changes', async () => { + const user = userEvent.setup(); + const onChangeSpy = jest.fn(); + render( + + ); + const input = getInput( defaultLabelText ); + + await user.click( input ); + expect( onChangeSpy ).not.toHaveBeenCalled(); + + await user.type( input, 'a' ); + expect( onChangeSpy ).toHaveBeenCalledTimes( 1 ); + expect( onChangeSpy ).toHaveBeenCalledWith( 'a' ); + } ); + it( 'should select the correct option from a search', async () => { const user = await userEvent.setup(); const targetOption = timezones[ 13 ];