mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-03 04:30:06 +08:00
parent
b427adec21
commit
b34557ef17
@ -500,7 +500,7 @@ export default class Table<T> extends React.Component<TableProps<T>, any> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
handlePageChange = (current) => {
|
handlePageChange = (current, ...otherArguments) => {
|
||||||
const props = this.props;
|
const props = this.props;
|
||||||
let pagination = assign({}, this.state.pagination);
|
let pagination = assign({}, this.state.pagination);
|
||||||
if (current) {
|
if (current) {
|
||||||
@ -508,7 +508,7 @@ export default class Table<T> extends React.Component<TableProps<T>, any> {
|
|||||||
} else {
|
} else {
|
||||||
pagination.current = pagination.current || 1;
|
pagination.current = pagination.current || 1;
|
||||||
}
|
}
|
||||||
pagination.onChange(pagination.current);
|
pagination.onChange(pagination.current, ...otherArguments);
|
||||||
|
|
||||||
const newState = {
|
const newState = {
|
||||||
pagination,
|
pagination,
|
||||||
|
@ -56,9 +56,10 @@ describe('Table.pagination', () => {
|
|||||||
|
|
||||||
it('fires change event', () => {
|
it('fires change event', () => {
|
||||||
const handleChange = jest.fn();
|
const handleChange = jest.fn();
|
||||||
|
const handlePaginationChange = jest.fn();
|
||||||
const noop = () => {};
|
const noop = () => {};
|
||||||
const wrapper = mount(createTable({
|
const wrapper = mount(createTable({
|
||||||
pagination: { ...pagination, onChange: noop, onShowSizeChange: noop },
|
pagination: { ...pagination, onChange: handlePaginationChange, onShowSizeChange: noop },
|
||||||
onChange: handleChange,
|
onChange: handleChange,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -67,13 +68,15 @@ describe('Table.pagination', () => {
|
|||||||
expect(handleChange).toBeCalledWith(
|
expect(handleChange).toBeCalledWith(
|
||||||
{
|
{
|
||||||
current: 2,
|
current: 2,
|
||||||
onChange: noop,
|
onChange: handlePaginationChange,
|
||||||
onShowSizeChange: noop,
|
onShowSizeChange: noop,
|
||||||
pageSize: 2,
|
pageSize: 2,
|
||||||
},
|
},
|
||||||
{},
|
{},
|
||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
expect(handlePaginationChange).toBeCalledWith(2, 2);
|
||||||
});
|
});
|
||||||
|
|
||||||
// https://github.com/ant-design/ant-design/issues/4532
|
// https://github.com/ant-design/ant-design/issues/4532
|
||||||
|
Loading…
Reference in New Issue
Block a user