Skip to content

Commit f2521e1

Browse files
author
machixian
committed
new test case
1 parent 92a63b9 commit f2521e1

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/index.test.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,3 +416,26 @@ describe('current value on onShowSizeChange when total is 0', () => {
416416
expect(wrapper4.exists('.rc-pagination-options-size-changer')).toBe(true);
417417
});
418418
});
419+
420+
describe('should emit onChange when total is string', () => {
421+
let wrapper;
422+
const onChange = jest.fn();
423+
424+
beforeEach(() => {
425+
wrapper = mount(
426+
<Pagination total="100" pageSize={10} onChange={onChange} />,
427+
);
428+
});
429+
430+
afterEach(() => {
431+
wrapper.unmount();
432+
onChange.mockReset();
433+
});
434+
435+
it('onChange should be called when click page', () => {
436+
const pagers = wrapper.find('.rc-pagination-item-3');
437+
const page1 = pagers.at(0);
438+
page1.simulate('click');
439+
expect(onChange).toBeCalledWith(3, 10);
440+
});
441+
});

0 commit comments

Comments
 (0)