Skip to content

Commit

Permalink
Fix empty message test
Browse files Browse the repository at this point in the history
  • Loading branch information
ErlingHauan committed May 13, 2024
1 parent 06f5f7f commit dc83829
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,6 @@ describe('StudioTableLocalPagination', () => {
emptyTableMessage='No rows to display'
/>,
);
expect(screen.getByRole('paragraph', { value: 'No rows to display' })).toBeInTheDocument();
expect(screen.getByText('No rows to display')).toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ export const StudioTableLocalPagination = forwardRef<
useEffect(() => {
const newRowsToRender = getRowsToRender(currentPage, pageSize, sortedRows || rows);

const outOfRange = !newRowsToRender.length && currentPage > 1;
if (outOfRange) {
const isOutOfRange = !newRowsToRender.length && currentPage > 1;
if (isOutOfRange) {
setCurrentPage(1);
setRowsToRender(getRowsToRender(1, pageSize, sortedRows || rows));
return;
}

setRowsToRender(newRowsToRender);
}, [sortedRows, currentPage, pageSize]);
}, [sortedRows, rows, currentPage, pageSize]);

const totalPages = Math.ceil(rows.length / pageSize);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,6 @@ describe('StudioTableRemotePagination', () => {
emptyTableMessage='No rows to display'
/>,
);
expect(screen.getByRole('paragraph', { value: 'No rows to display' })).toBeInTheDocument();
expect(screen.getByText('No rows to display')).toBeInTheDocument();
});
});

0 comments on commit dc83829

Please sign in to comment.