Added test case for custom iterators

This commit is contained in:
Patrick Steele-Idem 2014-02-06 21:13:51 -07:00
parent 1635f5c750
commit dd0b420a7a
2 changed files with 13 additions and 0 deletions

View File

@ -369,5 +369,17 @@ describe('raptor-templates/rhtml' , function() {
testRender("test-project/rhtml-templates/layout-use.rhtml", {}, done);
});
it("should work with custom iteration", function(done) {
testRender("test-project/rhtml-templates/looping-iterator.rhtml", {
reverseIterator: function(arrayList, callback){
var statusVar = {first: 0, last: arrayList.length-1};
for(var i=arrayList.length-1; i>=0; i--){
statusVar.index = i;
callback(arrayList[i], statusVar);
}
}
}, done);
});
});

View File

@ -0,0 +1 @@
cba2-c1-b0-a<div>c</div><div>b</div><div>a</div><div>2-c</div><div>1-b</div><div>0-a</div>