Skip to content

[material-ui][Pagination] Add tests for zero boundary and sibling counts - #49118

Merged
Janpot merged 1 commit into
mui:masterfrom
Janpot:test/pagination-zero-boundary-counts
Sep 9, 2026
Merged

[material-ui][Pagination] Add tests for zero boundary and sibling counts#49118
Janpot merged 1 commit into
mui:masterfrom
Janpot:test/pagination-zero-boundary-counts

Conversation

@Janpot

@Janpot Janpot commented Sep 8, 2026

Copy link
Copy Markdown
Member

There's almost no coverage for boundaryCount={0} siblingCount={0}. The one test we have uses count: 11, and the Pagination test called "boundaryCount is zero" sets siblingCount={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.

@Janpot Janpot added test scope: pagination Changes related to the pagination. labels Sep 8, 2026
@code-infra-dashboard

code-infra-dashboard Bot commented Sep 8, 2026

Copy link
Copy Markdown

Deploy preview

https://deploy-preview-49118--material-ui.netlify.app/
QR code for https://deploy-preview-49118--material-ui.netlify.app/

Bundle size

Bundle Parsed size Gzip size
@mui/material 0B(0.00%) 0B(0.00%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/private-theming 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

@Janpot
Janpot force-pushed the test/pagination-zero-boundary-counts branch 2 times, most recently from ed9d817 to cd8e48f Compare September 8, 2026 17:56
@Janpot
Janpot requested review from a team September 8, 2026 18:08
@silviuaavram
silviuaavram requested a balanced review from Copilot September 9, 2026 06:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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', () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we could improve with a test/it.each through usePagination input and the outputs.

@Janpot Janpot Sep 9, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's fine, let's keep this one. 👍🏽

@Janpot
Janpot merged commit c991a83 into mui:master Sep 9, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: pagination Changes related to the pagination. test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants