diff --git a/packages/ra-ui-materialui/src/list/List.spec.tsx b/packages/ra-ui-materialui/src/list/List.spec.tsx index d7e947b8a4..f8661d6355 100644 --- a/packages/ra-ui-materialui/src/list/List.spec.tsx +++ b/packages/ra-ui-materialui/src/list/List.spec.tsx @@ -345,25 +345,11 @@ describe('', () => { }); describe('"Select all" button', () => { - const Child = () => { - const [_, selectionModifiers] = useRecordSelection({ - resource: 'books', - }); - return ( - - ); - }; afterEach(() => { - fireEvent.click(screen.getByRole('button', { name: 'reset' })); + fireEvent.click(screen.getByRole('button', { name: 'Unselect' })); }); it('should be displayed if an item is selected', async () => { - render( - - - - ); + render(); await waitFor(() => { expect(screen.queryAllByRole('checkbox')).toHaveLength(11); }); @@ -395,9 +381,7 @@ describe('', () => { total: 2, }), })} - > - - + /> ); await waitFor(() => { expect(screen.queryAllByRole('checkbox')).toHaveLength(3); @@ -409,11 +393,7 @@ describe('', () => { ).toBeNull(); }); it('should not be displayed if all item are selected with the "Select all" button', async () => { - render( - - - - ); + render(); await waitFor(() => { expect(screen.queryAllByRole('checkbox')).toHaveLength(11); }); @@ -455,9 +435,7 @@ describe('', () => { total: 3, }), })} - > - - + /> ); await waitFor(() => { expect(screen.queryAllByRole('checkbox')).toHaveLength(4); @@ -470,11 +448,7 @@ describe('', () => { ).toBeNull(); }); it('should not be displayed if we reached the selectAllLimit by a click on the "Select all" button', async () => { - render( - - - - ); + render(); await waitFor(() => { expect(screen.queryAllByRole('checkbox')).toHaveLength(11); }); @@ -490,11 +464,7 @@ describe('', () => { ).toBeNull(); }); it('should select all items', async () => { - render( - - - - ); + render(); await waitFor(() => { expect(screen.queryAllByRole('checkbox')).toHaveLength(11); }); @@ -503,12 +473,8 @@ describe('', () => { fireEvent.click(screen.getByRole('button', { name: 'Select all' })); await screen.findByText('13 items selected'); }); - it('should select the maximum items possible until we reached the selectAllLimit', async () => { - render( - - - - ); + it.only('should select the maximum items possible until we reached the selectAllLimit', async () => { + render(); await waitFor(() => { expect(screen.queryAllByRole('checkbox')).toHaveLength(11); });