Skip to content

Commit

Permalink
Backport marmelab#9718
Browse files Browse the repository at this point in the history
  • Loading branch information
djhi authored and mjarosch committed Jul 1, 2024
1 parent 19e7181 commit e2dc458
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,9 @@ describe('<AutocompleteArrayInput />', () => {
});
expect(screen.getByText('Technical')).not.toBeNull();
expect(screen.getByText('Programming')).not.toBeNull();
expect(screen.getByText('ra.action.create_item')).not.toBeNull();
await waitFor(() => {
expect(screen.getByText('ra.action.create_item')).not.toBeNull();
});
});

it('should support creation of a new choice through the onCreate event when optionText is a function', async () => {
Expand Down Expand Up @@ -1108,8 +1110,9 @@ describe('<AutocompleteArrayInput />', () => {
]
);
});
screen.getByRole('combobox').blur();
expect(screen.getByDisplayValue('Russian')).not.toBeNull();
screen.getAllByRole('combobox')[0].focus();
screen.getByRole('combobox').focus();
fireEvent.click(await screen.findByText('Victor Hugo'));
await waitFor(() => {
expect(onChange).toHaveBeenCalledWith(
Expand Down
1 change: 0 additions & 1 deletion packages/ra-ui-materialui/src/input/AutocompleteInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,6 @@ If you provided a React element for the optionText prop, you must also provide t
return (
<>
<StyledAutocomplete
blurOnSelect
className={clsx('ra-input', `ra-input-${source}`, className)}
clearText={translate(clearText, { _: clearText })}
closeText={translate(closeText, { _: closeText })}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react';
import expect from 'expect';
import { render, fireEvent, screen, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { createTheme } from '@mui/material/styles';
import {
ListContextProvider,
Expand Down Expand Up @@ -234,14 +235,14 @@ describe('<FilterButton />', () => {
render(<WithAutoCompleteArrayInput />);

// Open Posts List
fireEvent.click(await screen.findByText('Posts'));
userEvent.click(await screen.findByText('Posts'));

await waitFor(() => {
expect(screen.queryAllByRole('checkbox')).toHaveLength(11);
});

fireEvent.click(await screen.findByLabelText('Open'));
fireEvent.click(await screen.findByText('Sint...'));
userEvent.click(await screen.findByLabelText('Open'));
userEvent.click(await screen.findByText('Sint...'));

await screen.findByLabelText('Add filter');
await waitFor(
Expand Down

0 comments on commit e2dc458

Please sign in to comment.