Skip to content

Commit ee7e7cd

Browse files
committed
fix(Pagination): add test case
1 parent f13fd0a commit ee7e7cd

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/index.test.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,27 @@ import { mount } from 'enzyme';
33
import Select from 'rc-select';
44
import Pagination from '../src';
55

6+
describe('Default Pagination', () => {
7+
let wrapper;
8+
const onChange = jest.fn();
9+
10+
beforeEach(() => {
11+
wrapper = mount(<Pagination onChange={onChange} />);
12+
});
13+
14+
afterEach(() => {
15+
wrapper.unmount();
16+
onChange.mockReset();
17+
});
18+
19+
it('onChange should be forbidden when total is default', () => {
20+
const pagers = wrapper.find('.rc-pagination-item');
21+
const page1 = pagers.at(0);
22+
page1.simulate('click');
23+
expect(onChange).toBeCalledTimes(0);
24+
});
25+
});
26+
627
describe('Uncontrolled Pagination', () => {
728
let wrapper;
829
const onChange = jest.fn();

0 commit comments

Comments
 (0)