react-bootstrap-table2/packages/react-bootstrap-table2-paginator/test/pagination-list.test.js
Allen 3c88364efe
fix #135
* init react-bootstrap-table2-paginator

* add react-bootstrap-table2-paginator as dependency

* no container

* handle for wrapping pagination component

* add style for paginator addon

* add story for pagination

* implement pagination list

* constants maintain in core package

* implement sizePerPage dropdown

* fix unalign for sizePerPage dropdown and pagination list

* allow to return array from render(react@16 new feature)

* implement pagination hooks

* add story for pagination hooks

* fixed dependencies version and upgrade enzyme

* Shallow renderer no longer calls componentDidMount because DOM refs are not available

* classNames -> className for TextEditor

* add tests for pagination

* fix react-bootstrap-table can't be resolved in other modules

* implement custom page button title

* add test for page button title

* fix bug when sizePerPageList is an object array

* add story for custom pagination

* remove necessary component extends

* move pagination options to react-bootstrap-table2-paginator

* refine pagination stories

* implement hideSizePerPage

* implement hidePageListOnlyOnePage

* fix multiple same key warning

* remove help

* support start from react@^16
2017-11-19 17:42:20 +08:00

43 lines
918 B
JavaScript

import React from 'react';
import sinon from 'sinon';
import { shallow } from 'enzyme';
import PageButton from '../src/page-button';
import PaginationList from '../src/pagination-list';
describe('PaginationList', () => {
let wrapper;
const onPageChange = sinon.stub();
const pages = [{
page: 1,
active: false,
disabled: false,
title: '1'
}, {
page: 2,
active: true,
disabled: false,
title: '2'
}, {
page: 3,
active: false,
disabled: false,
title: '3'
}];
beforeEach(() => {
wrapper = shallow(
<PaginationList
pages={ pages }
onPageChange={ onPageChange }
/>
);
});
it('should rendering PaginatonList correctly', () => {
expect(wrapper.length).toBe(1);
expect(wrapper.find('ul.react-bootstrap-table-page-btns-ul').length).toBe(1);
expect(wrapper.find(PageButton).length).toBe(pages.length);
});
});