From c088ea185dbf7122f41b160db31788f88cb2003d Mon Sep 17 00:00:00 2001 From: Alperen Date: Wed, 28 Oct 2026 10:10:16 +0300 Subject: [PATCH] [test][pagination] Test ellipses with zero boundary and sibling counts (#49090) Co-authored-by: Jan Potoms <2109932+Janpot@users.noreply.github.com> Co-authored-by: Zeeshan Tamboli --- .../src/usePagination/usePagination.test.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packages/mui-material/src/usePagination/usePagination.test.js b/packages/mui-material/src/usePagination/usePagination.test.js index b72081f6587f16..60a114cc6c23f7 100644 --- a/packages/mui-material/src/usePagination/usePagination.test.js +++ b/packages/mui-material/src/usePagination/usePagination.test.js @@ -179,6 +179,24 @@ describe('usePagination', () => { ]); }); + it('keeps ellipses when boundary and sibling counts are zero', () => { + const expectedByPage = [ + [1, ['previous', 1, 2, 'end-ellipsis', 'next']], + [2, ['previous', 1, 2, 'end-ellipsis', 'next']], + [5, ['previous', 'start-ellipsis', 5, 'end-ellipsis', 'next']], + [7, ['previous', 'start-ellipsis', 7, 'end-ellipsis', 'next']], + [9, ['previous', 'start-ellipsis', 9, 10, 'next']], + [10, ['previous', 'start-ellipsis', 9, 10, 'next']], + ]; + + expectedByPage.forEach(([page, expected]) => { + const items = renderHook(() => + usePagination({ count: 10, page, boundaryCount: 0, siblingCount: 0 }), + ).result.current.items; + expect(serialize(items), `page=${page}`).to.deep.equal(expected); + }); + }); + it('should never render a page item outside of the count range', () => { [0, 1, 2, 3, 4, 5, 11].forEach((count) => { [1, 3, 7].forEach((page) => {