feat: support filters in if/unless/case, see #287

This commit is contained in:
harttle
2021-02-12 22:22:41 +08:00
parent 4e82da689e
commit 2f059f6a25
18 changed files with 164 additions and 176 deletions
+9 -1
View File
@@ -1,5 +1,9 @@
import { Liquid } from '../../../src/liquid'
import { expect } from 'chai'
import * as chai from 'chai'
import * as chaiAsPromised from 'chai-as-promised'
chai.use(chaiAsPromised)
const expect = chai.expect
describe('LiquidOptions#strict*', function () {
let engine: Liquid
@@ -60,5 +64,9 @@ describe('LiquidOptions#strict*', function () {
const html = await engine.render(tpl, ctx, strictLenientOpts)
return expect(html).to.equal('a')
})
it('should not allow undefined variable even if `lenientIf` set', async function () {
const tpl = engine.parse('{{notdefined | tolower}}')
return expect(() => engine.renderSync(tpl, ctx, strictLenientOpts)).to.throw('undefined variable: notdefined')
})
})
})