Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[test] Add test to display options provided to the options prop even if loading is true. #41675

Merged
merged 1 commit into from
Mar 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading