1
0
mirror of synced 2025-12-25 02:17:36 -05:00

Refactor indented_data_reference to use Liquid internals (#16623)

* Refactor indented-data-reference

* Add spacing around referenced reusables

* Update expected test output

* Fail silently with empty valuer
This commit is contained in:
Jason Etcovitch
2020-11-24 16:50:20 -05:00
committed by GitHub
parent 35ebb6f973
commit 1ec8c35e34
4 changed files with 28 additions and 26 deletions

View File

@@ -85,36 +85,32 @@ describe('liquid helper tags', () => {
test('without any number of spaces specified', async () => {
const template = '{% indented_data_reference site.data.reusables.example %}'
const expected = ` <p>a rose by any other name
would smell as sweet</p>
`
const expected = ` a rose by any other name
would smell as sweet`
const output = await liquid.parseAndRender(template, context)
expect(output).toBe(expected)
})
test('with 0 spaces specified', async () => {
const template = '{% indented_data_reference site.data.reusables.example spaces=0 %}'
const expected = `<p>a rose by any other name
would smell as sweet</p>
`
const expected = `a rose by any other name
would smell as sweet`
const output = await liquid.parseAndRender(template, context)
expect(output).toBe(expected)
})
test('with 0 spaces specified and whitespace around equals sign', async () => {
const template = '{% indented_data_reference site.data.reusables.example spaces = 0 %}'
const expected = `<p>a rose by any other name
would smell as sweet</p>
`
const expected = `a rose by any other name
would smell as sweet`
const output = await liquid.parseAndRender(template, context)
expect(output).toBe(expected)
})
test('with 5 spaces specified', async () => {
const template = '{% indented_data_reference site.data.reusables.example spaces=5 %}'
const expected = ` <p>a rose by any other name
would smell as sweet</p>
`
const expected = ` a rose by any other name
would smell as sweet`
const output = await liquid.parseAndRender(template, context)
expect(output).toBe(expected)
})