Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/pages/api-docs/pagination.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ You can learn more about the difference by [reading this guide](/guides/minimizi
| Name | Type | Default | Description |
|:-----|:-----|:--------|:------------|
| <span class="prop-name">boundaryCount</span> | <span class="prop-type">number</span> | <span class="prop-default">1</span> | Number of always visible pages at the beginning and end. |
| <span class="prop-name">children</span> | <span class="prop-type">node</span> | | Pagination items. |
| <span class="prop-name">classes</span> | <span class="prop-type">object</span> | | Override or extend the styles applied to the component. See [CSS API](#css) below for more details. |
| <span class="prop-name">color</span> | <span class="prop-type">'default'<br>&#124;&nbsp;'primary'<br>&#124;&nbsp;'secondary'</span> | <span class="prop-default">'standard'</span> | The active color. |
| <span class="prop-name">count</span> | <span class="prop-type">number</span> | <span class="prop-default">1</span> | The total number of pages. |
Expand Down
2 changes: 0 additions & 2 deletions docs/src/pages/components/pagination/pagination.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ You can specify how many digits to display either side of current page with the

## Router integration

Pagination supports two approaches for Router integration, the `renderItem` prop:

{{"demo": "pages/components/pagination/PaginationLink.js"}}

## `usePagination`
Expand Down
30 changes: 12 additions & 18 deletions packages/material-ui-lab/src/Pagination/Pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ function defaultGetAriaLabel(type, page, selected) {
const Pagination = React.forwardRef(function Pagination(props, ref) {
const {
boundaryCount,
children,
classes,
className,
color = 'standard',
Expand Down Expand Up @@ -61,19 +60,18 @@ const Pagination = React.forwardRef(function Pagination(props, ref) {
{...other}
>
<ul className={classes.ul}>
{children ||
items.map((item, index) => (
<li key={index}>
{renderItem({
...item,
color,
'aria-label': getAriaLabel(item.type, item.page, item.selected),
shape,
size,
variant,
})}
</li>
))}
{items.map((item, index) => (
<li key={index}>
{renderItem({
...item,
color,
'aria-label': getAriaLabel(item.type, item.page, item.selected),
shape,
size,
variant,
})}
</li>
))}
</ul>
</nav>
);
Expand All @@ -86,10 +84,6 @@ Pagination.propTypes = {
* @default 1
*/
boundaryCount: PropTypes.number,
/**
* Pagination items.
*/
children: PropTypes.node,
/**
* Override or extend the styles applied to the component.
* See [CSS API](#css) below for more details.
Expand Down
14 changes: 0 additions & 14 deletions packages/material-ui-lab/src/Pagination/Pagination.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { createMount, getClasses } from '@material-ui/core/test-utils';
import describeConformance from '@material-ui/core/test-utils/describeConformance';
import { createClientRender } from 'test/utils/createClientRender';
import Pagination from './Pagination';
import { fireEvent } from '@testing-library/dom';

describe('<Pagination />', () => {
let classes;
Expand Down Expand Up @@ -52,17 +51,4 @@ describe('<Pagination />', () => {

expect(handleChange.callCount).to.equal(1);
});

it('does not attach onChange to the root element', () => {
const handleChange = spy();
const { getByRole } = render(
<Pagination count={3} onChange={handleChange} page={1}>
<input defaultValue={1} type="text" />
</Pagination>,
);

fireEvent.change(getByRole('textbox'), { target: { value: '2' } });

expect(handleChange.callCount).to.equal(0);
});
});