diff --git a/packages/material-ui-lab/src/Autocomplete/Autocomplete.test.js b/packages/material-ui-lab/src/Autocomplete/Autocomplete.test.js index 50b328d69b841d..1eade23ae29bba 100644 --- a/packages/material-ui-lab/src/Autocomplete/Autocomplete.test.js +++ b/packages/material-ui-lab/src/Autocomplete/Autocomplete.test.js @@ -77,6 +77,27 @@ describe('', () => { checkHighlightIs('one'); }); + it('should keep the highlight on the first item', () => { + const options = ['one', 'two']; + const { getByRole } = render( + } + />, + ); + + function checkHighlightIs(expected) { + expect(getByRole('listbox').querySelector('li[data-focus]')).to.have.text(expected); + } + + checkHighlightIs('one'); + fireEvent.change(document.activeElement, { target: { value: 'two' } }); + checkHighlightIs('two'); + }); + it('should set the highlight on selected item when dropdown is expanded', () => { const { getByRole, setProps } = render(