Skip to content

Commit c6df2ff

Browse files
dirPagination: 2 new tests and update tests to use current pagination-id syntax.
1 parent bb9203e commit c6df2ff

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/directives/pagination/dirPagination.spec.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ describe('dirPagination directive', function() {
710710
$scope.collection[paginationId] = collection;
711711
$scope.itemsPerPage[paginationId] = itemsPerPage;
712712
$scope.currentPage[paginationId] = currentPage || 1;
713-
expression = customExpression || "item in collection." + paginationId + " | itemsPerPage: itemsPerPage." + paginationId + ": '" + paginationId + "'";
713+
expression = customExpression || "item in collection." + paginationId + " | itemsPerPage: itemsPerPage." + paginationId;
714714
html = '<ul class="list"><li dir-paginate="'+ expression + '" current-page="currentPage.' + paginationId + '" pagination-id="' + paginationId + '" >{{ item }}</li></ul> ' +
715715
'<dir-pagination-controls pagination-id="' + paginationId + '"></dir-pagination-controls>';
716716
containingElement.append($compile(html)($scope));
@@ -824,6 +824,25 @@ describe('dirPagination directive', function() {
824824
expect(compile).toThrow("pagination directive: the itemsPerPage id argument (id: id2) does not match a registered pagination-id.");
825825
});
826826

827+
describe('valid expressions with pagination id', function() {
828+
829+
it('should allow track by syntax', function() {
830+
function compile() {
831+
compileMultipleInstance(collection1, 10, 1, "c1", "item in collection.c1 | itemsPerPage: itemsPerPage.c1");
832+
}
833+
expect(compile).not.toThrow();
834+
expect(getListItems().length).toEqual(10);
835+
});
836+
837+
it('should allow track by with other filter syntax', function() {
838+
function compile() {
839+
compileMultipleInstance(collection1, 10, 1, "c1", "item in collection.c1 | orderBy: reverse | itemsPerPage: itemsPerPage.c1");
840+
}
841+
expect(compile).not.toThrow();
842+
expect(getListItems().length).toEqual(10);
843+
});
844+
});
845+
827846
});
828847

829848
describe('pagination controls template API', function() {

0 commit comments

Comments
 (0)