(tpl, result)
| 137 | describe('Twig.js Control Structures ->', function () { |
| 138 | it('should have a loop context item available for arrays', function () { |
| 139 | function run(tpl, result) { |
| 140 | const testTemplate = twig({data: tpl}); |
| 141 | return testTemplate.renderAsync({ |
| 142 | test: [1, 2, 3, 4], async: () => Promise.resolve() |
| 143 | }) |
| 144 | .then(res => res.should.equal(result)); |
| 145 | } |
| 146 | |
| 147 | return Promise.resolve() |
| 148 | .then(() => run('{% for key,value in test %}{{async()}}{{ loop.index }}{% endfor %}', '1234')) |