diff --git a/src/Pagination.jsx b/src/Pagination.jsx index 3d6d07353..20545c8bb 100644 --- a/src/Pagination.jsx +++ b/src/Pagination.jsx @@ -20,7 +20,10 @@ export class Pagination extends React.Component { _calculatePages( props ) { const from = props.from || 0; - const size = props.size || 1; + var size = props.size || 1; + if ( size > 100 ) { + size = 100; + } const total = props.total || 0; const c = Math.ceil( from / size ) + 1; diff --git a/src/__tests__/Pagination.spec.jsx b/src/__tests__/Pagination.spec.jsx index be710ab63..bbf6bfcdf 100644 --- a/src/__tests__/Pagination.spec.jsx +++ b/src/__tests__/Pagination.spec.jsx @@ -74,6 +74,13 @@ it('records text input from the user', () => { expect(target.state('inputValue')).toEqual(49) }) +it('corrects large size to size limit', () => { + const target = shallow() + + // Expect 1000 / 100 + expect(target.state('total')).toEqual(10) +}) + describe('disabled buttons', () => { it('disables the previous button when on the first page', () => { const target = shallow()