mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 21:00:40 -07:00
fix: for tag not respecting Drop#valueOf(), fixes #515
This commit is contained in:
@@ -61,4 +61,15 @@ describe('drop/drop', function () {
|
||||
const html = await liquid.parseAndRender(`{{obj.foo}}`, { obj: new PromiseDrop() })
|
||||
expect(html).to.equal('FOO')
|
||||
})
|
||||
it('should respect valueOf', async () => {
|
||||
class CustomDrop extends Drop {
|
||||
prop = 'not enumerable'
|
||||
valueOf () {
|
||||
return ['foo', 'bar']
|
||||
}
|
||||
}
|
||||
const tpl = '{{drop}}: {% for field in drop %}{{ field }};{% endfor %}'
|
||||
const html = await liquid.parseAndRender(tpl, { drop: new CustomDrop() })
|
||||
expect(html).to.equal('foobar: foo;bar;')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user