mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Added test case for custom iterators
This commit is contained in:
parent
1635f5c750
commit
dd0b420a7a
@ -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);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
@ -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>
|
||||
Loading…
x
Reference in New Issue
Block a user