Skip to content

Commit 8b5dcc4

Browse files
committed
Further improve the tests
1 parent c366095 commit 8b5dcc4

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

packages/ra-core/src/controller/list/ListBase.spec.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ describe('ListBase', () => {
175175
});
176176
it('should render nothing while loading if emptyWhileLoading is set to true and using the render prop', async () => {
177177
render(<EmptyWhileLoadingRender />);
178+
expect(screen.queryByText('Loading...')).toBeNull();
178179
expect(screen.queryByText('War and Peace')).toBeNull();
179180
fireEvent.click(screen.getByText('Resolve books loading'));
180181
await screen.findByText('War and Peace');

packages/ra-core/src/controller/list/ListBase.stories.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -493,13 +493,17 @@ export const EmptyWhileLoadingRender = () => {
493493
resource="books"
494494
perPage={5}
495495
emptyWhileLoading
496-
render={({ data }) => (
497-
<ul>
498-
{data.map((record: any) => (
499-
<li key={record.id}>{record.title}</li>
500-
))}
501-
</ul>
502-
)}
496+
render={({ isPending, data }) =>
497+
isPending ? (
498+
<p>Loading...</p>
499+
) : (
500+
<ul>
501+
{data.map((record: any) => (
502+
<li key={record.id}>{record.title}</li>
503+
))}
504+
</ul>
505+
)
506+
}
503507
/>
504508
</CoreAdminContext>
505509
);

0 commit comments

Comments
 (0)