fix(design): correct the incident list footer range on empty and out-of-range pages
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -93,6 +93,21 @@ describe('IncidentTable', () => {
|
||||
expect(replace).toHaveBeenCalledWith('/hse/incidents?page=2')
|
||||
})
|
||||
|
||||
it('hides the footer when there are no results', () => {
|
||||
render(<IncidentTable {...props} incidents={[]} total={0} counts={{ all: 0, open: 0, closed: 0 }} />)
|
||||
expect(screen.queryByText(/Showing/)).toBeNull()
|
||||
})
|
||||
|
||||
it('shows a sane range on a page past the end', () => {
|
||||
render(<IncidentTable {...props} incidents={[]} total={7} params={{ ...props.params, page: 2 }} />)
|
||||
expect(screen.getByText('Showing 0–0 of 7')).toBeTruthy()
|
||||
})
|
||||
|
||||
it('shows the range for a partial last page', () => {
|
||||
render(<IncidentTable {...props} total={27} params={{ ...props.params, page: 2 }} />)
|
||||
expect(screen.getByText('Showing 26–27 of 27')).toBeTruthy()
|
||||
})
|
||||
|
||||
it('renders the stacked mobile list', () => {
|
||||
const { container } = render(<IncidentTable {...props} />)
|
||||
expect(container.querySelector('ul.md\\:hidden')).not.toBeNull()
|
||||
|
||||
Reference in New Issue
Block a user