fix: newline_to_br filter should output <br /> instead of <br/>, fixes #320

This commit is contained in:
Jun Yang
2021-03-13 17:14:10 +08:00
parent 99d14e76d7
commit 9a9b792c63
3 changed files with 12 additions and 5 deletions
+8 -1
View File
@@ -1,4 +1,4 @@
import { Liquid } from '../..'
import { Liquid } from '../../src/liquid'
import { Liquid as LiquidUMD } from '../../dist/liquid.browser.umd.js'
import { expect, use } from 'chai'
import * as chaiAsPromised from 'chai-as-promised'
@@ -95,4 +95,11 @@ describe('Issues', function () {
)
expect(html).to.equal('falsefalse')
})
it('#321 comparison for empty/nil', async () => {
const engine = new Liquid()
const html = await engine.parseAndRender(
`{{ 'a \n b \n c' | newline_to_br | split: '<br />' }}`
)
expect(html).to.equal('a ,\n b ,\n c')
})
})
+3 -3
View File
@@ -26,9 +26,9 @@ describe('filters/html', function () {
'there\n' +
'{% endcapture %}' +
'{{ string_with_newlines | newline_to_br }}'
const dst = '<br/>' +
'Hello<br/>' +
'there<br/>'
const dst = '<br />\n' +
'Hello<br />\n' +
'there<br />\n'
return test(src, dst)
})
})