mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 21:00:40 -07:00
feat: orderedFilterParameters, closes #312
This commit is contained in:
@@ -215,6 +215,13 @@ describe('tags/for', function () {
|
||||
})
|
||||
|
||||
it('should support for reversed in the first position', async function () {
|
||||
const src = '{% for i in (1..8) reversed limit:2 %}{{ i }}{% endfor %}'
|
||||
const html = await liquid.parseAndRender(src, scope)
|
||||
return expect(html).to.equal('21')
|
||||
})
|
||||
|
||||
it('should support for reversed in the first position with orderedFilterParameters=true', async function () {
|
||||
const liquid = new Liquid({ orderedFilterParameters: true })
|
||||
const src = '{% for i in (1..8) reversed limit:2 %}{{ i }}{% endfor %}'
|
||||
const html = await liquid.parseAndRender(src, scope)
|
||||
return expect(html).to.equal('87')
|
||||
@@ -225,6 +232,13 @@ describe('tags/for', function () {
|
||||
const html = await liquid.parseAndRender(src)
|
||||
return expect(html).to.equal('543')
|
||||
})
|
||||
|
||||
it('should support for reversed in the middle position with orderedFilterParameters=true', async function () {
|
||||
const liquid = new Liquid({ orderedFilterParameters: true })
|
||||
const src = '{% for i in (1..8) offset:2 reversed limit:3 %}{{ i }}{% endfor %}'
|
||||
const html = await liquid.parseAndRender(src)
|
||||
return expect(html).to.equal('876')
|
||||
})
|
||||
})
|
||||
|
||||
describe('sync', function () {
|
||||
|
||||
Reference in New Issue
Block a user