mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 12:50:38 -07:00
fix: contains operator does not support Drop, fixes #492
This commit is contained in:
+10
-1
@@ -1,4 +1,4 @@
|
||||
import { Liquid } from '../..'
|
||||
import { Liquid, Drop } from '../..'
|
||||
import { expect, use } from 'chai'
|
||||
import * as chaiAsPromised from 'chai-as-promised'
|
||||
import * as sinon from 'sinon'
|
||||
@@ -232,4 +232,13 @@ describe('Issues', function () {
|
||||
const html = await engine.parseAndRender(`{% assign a = "x,y,z" | split: ',' -%}{{ a[-1] }} {{ a[-3] }} {{ a[-8] }}`)
|
||||
expect(html).to.equal('z x ')
|
||||
})
|
||||
it('#492 contains operator does not support Drop', async () => {
|
||||
class TemplateDrop extends Drop {
|
||||
valueOf () { return 'product' }
|
||||
}
|
||||
const engine = new Liquid()
|
||||
const ctx = { template: new TemplateDrop() }
|
||||
const html = await engine.parseAndRender(`{% if template contains "product" %}contains{%endif%}`, ctx)
|
||||
expect(html).to.equal('contains')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user