[material-ui][Pagination] Add tests for zero boundary and sibling counts - #49118
Conversation
Deploy previewBundle size
Check out the code infra dashboard for more information about this PR. |
ed9d817 to
cd8e48f
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The test-only changes provide focused regression coverage with no unresolved issues.
Pull request overview
Adds regression coverage for Pagination with zero boundary and sibling counts.
Changes:
- Tests small and zero page counts.
- Verifies page validity, reachability, and navigation controls.
File summaries
| File | Description |
|---|---|
packages/mui-material/src/usePagination/usePagination.test.js |
Covers generated items and navigation edge cases. |
packages/mui-material/src/Pagination/Pagination.test.js |
Verifies zero-count rendering with disabled navigation controls. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| }); | ||
| }); | ||
|
|
||
| it('should keep every page reachable when they all fit', () => { |
There was a problem hiding this comment.
nit: we could improve with a test/it.each through usePagination input and the outputs.
There was a problem hiding this comment.
I pushed a version with it.each yesterday but it felt less readable so I reverted in the end. Happy to put it back if you prefer it.
There was a problem hiding this comment.
that's fine, let's keep this one. 👍🏽
There's almost no coverage for
boundaryCount={0} siblingCount={0}. The one test we have usescount: 11, and the Pagination test called "boundaryCount is zero" setssiblingCount={1}, so it never hits this code path.These check what the hook does today, not what we might want it to do. #49090 changes this path to show only the current page, which also hides pages that were clickable before when the count is small. Merging these first means that PR has to change a test on purpose.