From 13b76671e7fe8dc8e5b9d7834f3bfc74f8970436 Mon Sep 17 00:00:00 2001 From: terminalchai Date: Thu, 9 Apr 2026 01:53:53 +0530 Subject: [PATCH] test: cover empty state with permanent filters --- .../ra-ui-materialui/src/list/List.spec.tsx | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/packages/ra-ui-materialui/src/list/List.spec.tsx b/packages/ra-ui-materialui/src/list/List.spec.tsx index 8ea417c5d22..45a68f6e450 100644 --- a/packages/ra-ui-materialui/src/list/List.spec.tsx +++ b/packages/ra-ui-materialui/src/list/List.spec.tsx @@ -237,6 +237,36 @@ describe('', () => { screen.getByText('dummy'); }); }); + + it('should render the empty component when only a permanent filter is set', async () => { + const Dummy = () => { + const { isPending } = useListContext(); + return
{isPending ? 'loading' : 'dummy'}
; + }; + const CustomEmpty = () =>
Custom Empty
; + const dataProvider = { + getList: jest.fn(() => Promise.resolve({ data: [], total: 0 })), + } as any; + + render( + + + } + > + + + + + ); + + await waitFor(() => { + expect(screen.queryByText('dummy')).toBeNull(); + screen.getByText('Custom Empty'); + }); + }); }); it('should render a filter button/form combo when passed an element in filters', async () => {