Skip to content

Commit 52c757b

Browse files
committed
✅ test case
1 parent 937e4c3 commit 52c757b

File tree

1 file changed

+41
-4
lines changed

1 file changed

+41
-4
lines changed

tests/index.test.js

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ describe('current value on onShowSizeChange when total is 0', () => {
323323
input.simulate('keyDown', { key: 'Enter', keyCode: 13, which: 13 });
324324
expect(onShowSizeChange).toHaveBeenLastCalledWith(
325325
wrapper.state().current,
326-
25,
326+
20,
327327
);
328328
});
329329

@@ -341,30 +341,67 @@ describe('current value on onShowSizeChange when total is 0', () => {
341341
const wrapper1 = mount(
342342
<Pagination
343343
selectComponentClass={Select}
344-
total={99}
344+
total={50}
345345
/>,
346346
);
347347
expect(wrapper1.exists('.rc-pagination-options-size-changer')).toBe(false);
348348
const wrapper2 = mount(
349349
<Pagination
350350
selectComponentClass={Select}
351-
total={100}
351+
total={51}
352352
/>,
353353
);
354354
expect(wrapper2.exists('.rc-pagination-options-size-changer')).toBe(true);
355355
const wrapper3 = mount(
356356
<Pagination
357357
selectComponentClass={Select}
358358
showSizeChanger={false}
359+
total={51}
360+
/>,
361+
);
362+
expect(wrapper3.exists('.rc-pagination-options-size-changer')).toBe(false);
363+
const wrapper4 = mount(
364+
<Pagination
365+
selectComponentClass={Select}
366+
showSizeChanger
367+
total={50}
368+
/>,
369+
);
370+
expect(wrapper4.exists('.rc-pagination-options-size-changer')).toBe(true);
371+
});
372+
373+
it('totalBoundaryShowSizeChanger works', () => {
374+
const wrapper1 = mount(
375+
<Pagination
376+
selectComponentClass={Select}
359377
total={100}
378+
totalBoundaryShowSizeChanger={100}
379+
/>,
380+
);
381+
expect(wrapper1.exists('.rc-pagination-options-size-changer')).toBe(false);
382+
const wrapper2 = mount(
383+
<Pagination
384+
selectComponentClass={Select}
385+
total={101}
386+
totalBoundaryShowSizeChanger={100}
387+
/>,
388+
);
389+
expect(wrapper2.exists('.rc-pagination-options-size-changer')).toBe(true);
390+
const wrapper3 = mount(
391+
<Pagination
392+
selectComponentClass={Select}
393+
showSizeChanger={false}
394+
total={101}
395+
totalBoundaryShowSizeChanger={100}
360396
/>,
361397
);
362398
expect(wrapper3.exists('.rc-pagination-options-size-changer')).toBe(false);
363399
const wrapper4 = mount(
364400
<Pagination
365401
selectComponentClass={Select}
366402
showSizeChanger
367-
total={99}
403+
total={100}
404+
totalBoundaryShowSizeChanger={100}
368405
/>,
369406
);
370407
expect(wrapper4.exists('.rc-pagination-options-size-changer')).toBe(true);

0 commit comments

Comments
 (0)