Skip to content

Commit fee46ae

Browse files
committed
Init michaelbromley#281 Add specs for onPageChange oldPageNumber param
1 parent 60c86e5 commit fee46ae

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/directives/pagination/dirPagination.spec.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,15 @@ describe('dirPagination directive', function() {
644644
$scope.$apply();
645645
expect($scope.myCallback).toHaveBeenCalledWith(2);
646646
});
647+
648+
it('should pass the previous page number to the callback', function() {
649+
compileWithAttributes(' on-page-change="myCallback(oldPageNumber)" ');
650+
var pagination = containingElement.find('ul.pagination');
651+
652+
pagination.children().eq(3).find('a').triggerHandler('click');
653+
$scope.$apply();
654+
expect($scope.myCallback).toHaveBeenCalledWith(1);
655+
});
647656
});
648657

649658
describe('total-items attribute', function() {

0 commit comments

Comments
 (0)