react-paginate
Advanced tools
Comparing version 0.5.6 to 0.5.7
@@ -7,2 +7,3 @@ import React from 'react'; | ||
jest.dontMock('./../react_components/PageView'); | ||
jest.dontMock('./../react_components/BreakView'); | ||
@@ -12,2 +13,3 @@ const PaginationBoxView = require('./../react_components/PaginationBoxView').default; | ||
const PageView = require('./../react_components/PageView').default; | ||
const BreakView = require('./../react_components/BreakView').default; | ||
@@ -30,3 +32,3 @@ import ReactTestUtils from 'react-addons-test-utils'; | ||
const pages = ReactDOM.findDOMNode(pagination).querySelectorAll("li"); | ||
expect(pages.length).toEqual(9); | ||
expect(pages.length).toEqual(10); | ||
}); | ||
@@ -62,6 +64,7 @@ | ||
); | ||
const pageItems = ReactDOM.findDOMNode(smallPagination).querySelectorAll("li"); | ||
// Prev, current, next | ||
expect(pageItems.length).toBe(4); | ||
expect(pageItems.length).toBe(5); | ||
}); | ||
}); |
@@ -73,3 +73,3 @@ import React, { Component } from 'react'; | ||
nextLabel={"next"} | ||
breakLabel={<li className="break"><a href="">...</a></li>} | ||
breakLabel={<a href="">...</a>} | ||
pageNum={this.state.pageNum} | ||
@@ -76,0 +76,0 @@ marginPagesDisplayed={2} |
@@ -21,2 +21,6 @@ 'use strict'; | ||
var _BreakView = require('./BreakView'); | ||
var _BreakView2 = _interopRequireDefault(_BreakView); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -68,19 +72,20 @@ | ||
var index = undefined; | ||
var page = undefined; | ||
var _index = void 0; | ||
var page = void 0; | ||
var breakView = void 0; | ||
for (index = 0; index < this.props.pageNum; index++) { | ||
for (_index = 0; _index < this.props.pageNum; _index++) { | ||
page = index + 1; | ||
page = _index + 1; | ||
var pageView = _react2.default.createElement(_PageView2.default, { | ||
onClick: this.props.onPageSelected.bind(null, index), | ||
selected: this.props.selected === index, | ||
onClick: this.props.onPageSelected.bind(null, _index), | ||
selected: this.props.selected === _index, | ||
pageClassName: this.props.pageClassName, | ||
pageLinkClassName: this.props.pageLinkClassName, | ||
activeClassName: this.props.activeClassName, | ||
page: index + 1 }); | ||
page: _index + 1 }); | ||
if (page <= this.props.marginPagesDisplayed) { | ||
items['key' + index] = pageView; | ||
items['key' + _index] = pageView; | ||
continue; | ||
@@ -90,8 +95,8 @@ } | ||
if (page > this.props.pageNum - this.props.marginPagesDisplayed) { | ||
items['key' + index] = pageView; | ||
items['key' + _index] = pageView; | ||
continue; | ||
} | ||
if (index >= this.props.selected - leftSide && index <= this.props.selected + rightSide) { | ||
items['key' + index] = pageView; | ||
if (_index >= this.props.selected - leftSide && _index <= this.props.selected + rightSide) { | ||
items['key' + _index] = pageView; | ||
continue; | ||
@@ -104,4 +109,6 @@ } | ||
if (breakLabelValue !== this.props.breakLabel) { | ||
items['key' + index] = this.props.breakLabel; | ||
if (breakLabelValue !== breakView) { | ||
breakView = _react2.default.createElement(_BreakView2.default, { breakLabel: this.props.breakLabel }); | ||
items['key' + _index] = breakView; | ||
} | ||
@@ -108,0 +115,0 @@ } |
{ | ||
"name": "react-paginate", | ||
"version": "0.5.6", | ||
"version": "0.5.7", | ||
"description": "A ReactJS component that creates a pagination.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -6,2 +6,3 @@ 'use strict'; | ||
import PageView from './PageView'; | ||
import BreakView from './BreakView'; | ||
@@ -41,2 +42,3 @@ | ||
let page; | ||
let breakView; | ||
@@ -76,4 +78,8 @@ for (index = 0; index < this.props.pageNum; index++) { | ||
if (breakLabelValue !== this.props.breakLabel) { | ||
items['key' + index] = this.props.breakLabel; | ||
if (breakLabelValue !== breakView) { | ||
breakView = ( | ||
<BreakView breakLabel={this.props.breakLabel} /> | ||
); | ||
items['key' + index] = breakView; | ||
} | ||
@@ -80,0 +86,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
247957
35
837