From de4db28283f9256995b9890d513bc5cdac90dae6 Mon Sep 17 00:00:00 2001 From: Zeeshan Tamboli Date: Wed, 27 Mar 2024 13:01:19 +0530 Subject: [PATCH] [test] Add test to display options provided to the options prop even if loading is true. (#41675) --- .../src/Autocomplete/Autocomplete.test.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/mui-material/src/Autocomplete/Autocomplete.test.js b/packages/mui-material/src/Autocomplete/Autocomplete.test.js index a306ea4fc262c4..9446aa9aed4a29 100644 --- a/packages/mui-material/src/Autocomplete/Autocomplete.test.js +++ b/packages/mui-material/src/Autocomplete/Autocomplete.test.js @@ -145,6 +145,23 @@ describe('', () => { fireEvent.keyDown(screen.getByRole('combobox'), { key: 'ArrowDown' }); expect(document.querySelector(`.${classes.paper}`).textContent).to.equal('Loading…'); }); + + it('should show supplied options to the "options" prop even when loading', () => { + render( + } + />, + ); + + fireEvent.keyDown(screen.getByRole('combobox'), { key: 'ArrowDown' }); + expect(document.querySelector(`.${classes.paper}`).textContent).not.to.equal('Loading…'); + + const listbox = screen.getByRole('listbox'); + const htmlOptions = listbox.querySelectorAll('li'); + expect(htmlOptions[0].innerHTML).to.equal('one'); + }); }); describe('prop: autoHighlight', () => {