Skip to content

Commit

Permalink
Fix #469
Browse files Browse the repository at this point in the history
  • Loading branch information
javve committed Feb 4, 2017
1 parent 8b406b4 commit b3db0de
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
8 changes: 8 additions & 0 deletions __test__/pagination.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ describe('Pagination', function() {
expect($(pagination.find('li').get(2)).hasClass('active')).toEqual(false);
expect($(pagination.find('li').get(3)).hasClass('active')).toEqual(true);
});

it('should handle page = 0', function() {
expect(pagination.is(':visible')).toBe(true);
list.show(0, 0);
expect(pagination.is(':visible')).toBe(false);
list.show(1, 1);
expect(pagination.is(':visible')).toBe(true);
});
});


Expand Down
10 changes: 9 additions & 1 deletion src/pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,17 @@ var classes = require('./utils/classes'),
List = require('./index');

module.exports = function(list) {
var isHidden = false;

var refresh = function(pagingList, options) {
if (list.page < 1) {
list.listContainer.style.display = 'none';
isHidden = true
return;
} else if (isHidden){
list.listContainer.style.display = 'block';
}

var item,
l = list.matchingItems.length,
index = list.i,
Expand All @@ -16,7 +25,6 @@ module.exports = function(list) {
right = options.right || options.outerWindow || 0;

right = pages - right;

pagingList.clear();
for (var i = 1; i <= pages; i++) {
var className = (currentPage === i) ? "active" : "";
Expand Down

0 comments on commit b3db0de

Please sign in to comment.