Skip to content

Commit

Permalink
add a failing test that replicates the issue begriffs#62
Browse files Browse the repository at this point in the history
Passive Pagination page links do not update when items per page is altered
begriffs#62
  • Loading branch information
Rodel30 committed Sep 19, 2015
1 parent d415d77 commit 07b6eaf
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/paginate-anything-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,34 @@

expect(elt.find('ul').length).toEqual(2);
});

it('updates page numbers when per page changes', function () {

function secondToLastLIShouldHaveText(ul, text){
var lis = ul.find('li');
expect(lis.eq(lis.length - 2).text().trim()).toEqual(text);
}

$httpBackend.whenGET('/items').respond(
finiteStringBackend('abcdefghijklmnopqrstuvwxyz')
);
scope.perPage = 5;

scope.page = 0;
var elt = $compile(template)(scope);
scope.$digest();
$httpBackend.flush();

secondToLastLIShouldHaveText(elt.find('ul').eq(0), '6');
secondToLastLIShouldHaveText(elt.find('ul').eq(1), '6');

scope.perPage = 3;
scope.$digest();
$httpBackend.flush();

secondToLastLIShouldHaveText(elt.find('ul').eq(0), '9');
secondToLastLIShouldHaveText(elt.find('ul').eq(1), '9');
});
});

describe('events', function () {
Expand Down

0 comments on commit 07b6eaf

Please sign in to comment.