mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-15 04:10:40 -07:00
fix: expression support Drop.valueOf, fixes #522
This commit is contained in:
@@ -72,4 +72,16 @@ describe('drop/drop', function () {
|
||||
const html = await liquid.parseAndRender(tpl, { drop: new CustomDrop() })
|
||||
expect(html).to.equal('foobar: foo;bar;')
|
||||
})
|
||||
it('should support valueOf in == expression', async () => {
|
||||
class AddressDrop extends Drop {
|
||||
valueOf () {
|
||||
return 'test'
|
||||
}
|
||||
}
|
||||
const address = new AddressDrop()
|
||||
const customer = { default_address: new AddressDrop() }
|
||||
const tpl = `{% if address == customer.default_address %}{{address}}{% endif %}`
|
||||
const html = await liquid.parseAndRender(tpl, { address, customer })
|
||||
expect(html).to.equal('test')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user