diff --git a/packages/ra-ui-materialui/src/input/AutocompleteArrayInput.spec.tsx b/packages/ra-ui-materialui/src/input/AutocompleteArrayInput.spec.tsx index 521c5d54af4..27c6af76458 100644 --- a/packages/ra-ui-materialui/src/input/AutocompleteArrayInput.spec.tsx +++ b/packages/ra-ui-materialui/src/input/AutocompleteArrayInput.spec.tsx @@ -1081,7 +1081,9 @@ describe('', () => { ); }); expect(screen.getByDisplayValue('Russian')).not.toBeNull(); - screen.getAllByRole('textbox')[0].focus(); + fireEvent.keyDown(screen.getAllByRole('textbox')[0], { + key: 'ArrowDown', + }); fireEvent.click(await screen.findByText('Victor Hugo')); await waitFor(() => { expect(onChange).toHaveBeenCalledWith( diff --git a/packages/ra-ui-materialui/src/input/AutocompleteInput.tsx b/packages/ra-ui-materialui/src/input/AutocompleteInput.tsx index 43c05af43e1..b267870823d 100644 --- a/packages/ra-ui-materialui/src/input/AutocompleteInput.tsx +++ b/packages/ra-ui-materialui/src/input/AutocompleteInput.tsx @@ -555,7 +555,6 @@ If you provided a React element for the optionText prop, you must also provide t return ( <> ', () => { filterValues: {}, }; + beforeAll(() => { + window.scrollTo = jest.fn(); + }); + describe('filter selection menu', () => { it('should display only hidden filters', () => { const hiddenFilter = ( @@ -189,14 +194,14 @@ describe('', () => { render(); // 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 waitFor( () => { @@ -205,15 +210,15 @@ describe('', () => { { timeout: 10000 } ); - fireEvent.click(screen.getByLabelText('Add filter')); - fireEvent.click(screen.getByText('Remove all filters')); + userEvent.click(screen.getByLabelText('Add filter')); + userEvent.click(screen.getByText('Remove all filters')); await waitFor(() => { expect(screen.getAllByRole('checkbox')).toHaveLength(11); }); - fireEvent.click(screen.getByLabelText('Open')); - fireEvent.click(screen.getByText('Sint...')); + userEvent.click(screen.getByLabelText('Open')); + userEvent.click(screen.getByText('Sint...')); await waitFor(() => { expect(