From 40b31b0a9c5dc8c99d6e843944e00b11c9fb38d3 Mon Sep 17 00:00:00 2001 From: ZeeshanTamboli Date: Wed, 27 Mar 2024 11:13:28 +0530 Subject: [PATCH] add test --- .../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', () => {