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:
@@ -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)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user