Skip to content

Commit

Permalink
[test] Add test to display options provided to the options prop even …
Browse files Browse the repository at this point in the history
…if loading is true. (#41675)
  • Loading branch information
ZeeshanTamboli authored Mar 27, 2024
1 parent e85839f commit d5c16c1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions packages/mui-material/src/Autocomplete/Autocomplete.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,23 @@ describe('<Autocomplete />', () => {
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(
<Autocomplete
options={['one', 'two']}
loading
renderInput={(params) => <TextField {...params} autoFocus />}
/>,
);

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', () => {
Expand Down

0 comments on commit d5c16c1

Please sign in to comment.