diff --git a/packages/mui-material/src/Autocomplete/Autocomplete.test.js b/packages/mui-material/src/Autocomplete/Autocomplete.test.js index 18b9253c28f015..73bb087d074cfb 100644 --- a/packages/mui-material/src/Autocomplete/Autocomplete.test.js +++ b/packages/mui-material/src/Autocomplete/Autocomplete.test.js @@ -414,39 +414,6 @@ describe('', () => { expect(getAllByRole('button', { hidden: false })).to.have.lengthOf(5); } }); - - // Test for https://github.com/mui/material-ui/issues/42432 - it('when the input box needs to expand downward, the listbox should remain open.', () => { - const options = [ - 'The Lord of the Rings: The Return of the King', - 'The Good, the Bad and the Ugly', - 'The Shawshank Redemption', - 'Star Wars: Episode V - The Empire Strikes Back', - ]; - const defaultValue = [ - 'The Lord of the Rings: The Return of the King', - 'The Good, the Bad and the Ugly', - 'The Shawshank Redemption', - ]; - - render( - } - sx={{ width: 500 }} - />, - ); - - const textbox = screen.getByRole('combobox'); - - fireEvent.mouseDown(textbox); - - const listbox = screen.getByRole('listbox'); - expect(listbox).toBeVisible(); - }); }); describe('prop: filterSelectedOptions', () => { @@ -896,7 +863,7 @@ describe('', () => { />, ); - expect(queryByRole('listbox')).to.equal(null); + expect(queryByRole('listbox')).to.equal(null); const popupIndicator = getByTestId('popup-indicator'); await user.click(popupIndicator); diff --git a/test/regressions/fixtures/Autocomplete/TextboxExpandsOnListboxOpen.js b/test/regressions/fixtures/Autocomplete/TextboxExpandsOnListboxOpen.js new file mode 100644 index 00000000000000..d5c43e69c0bc78 --- /dev/null +++ b/test/regressions/fixtures/Autocomplete/TextboxExpandsOnListboxOpen.js @@ -0,0 +1,18 @@ +import * as React from 'react'; +import TextField from '@mui/material/TextField'; +import Autocomplete from '@mui/material/Autocomplete'; + +export default function StandardAutocomplete() { + return ( +
+ } + sx={{ width: 300 }} + /> +
+ ); +} diff --git a/test/regressions/index.test.js b/test/regressions/index.test.js index 4eb8657c904c32..290b89661556b1 100644 --- a/test/regressions/index.test.js +++ b/test/regressions/index.test.js @@ -131,6 +131,20 @@ async function main() { await takeScreenshot({ testcase, route: '/regression-Rating/PreciseFocusVisibleRating3' }); }); }); + + describe('Autocomplete', () => { + it('should not close immediately when textbox expands', async () => { + const testcase = await renderFixture( + '/regression-Autocomplete/TextboxExpandsOnListboxOpen', + ); + await page.getByRole('combobox').click(); + await page.waitForTimeout(10); + await takeScreenshot({ + testcase, + route: '/regression-Autocomplete/TextboxExpandsOnListboxOpen2', + }); + }); + }); }); run();