mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-18 05:50:43 -07:00
fix: some filters throw on nil input, see #481
This commit is contained in:
@@ -207,4 +207,18 @@ describe('Issues', function () {
|
||||
const html = await engine.render(tpl, { v: undefined })
|
||||
expect(html).to.equal('')
|
||||
})
|
||||
it('#481 filters that should not throw', async () => {
|
||||
const engine = new Liquid()
|
||||
const tpl = engine.parse(`
|
||||
{{ foo | join }}
|
||||
{{ foo | map: "k" }}
|
||||
{{ foo | reverse }}
|
||||
{{ foo | slice: 2 }}
|
||||
{{ foo | newline_to_br }}
|
||||
{{ foo | strip_html }}
|
||||
{{ foo | truncatewords }}
|
||||
`)
|
||||
const html = await engine.render(tpl, { foo: undefined })
|
||||
expect(html.trim()).to.equal('')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user