import { expect } from 'chai' import { Liquid } from '../../../src/liquid' const liquid = new Liquid() const cases = [ { text: `

{{ 'John' }}

`, expected: `

John

` }, { text: `

{{- 'John' -}}

`, expected: `

John

` }, { text: `

{%- if true -%} yes {%- endif -%}

`, expected: `

yes

` }, { text: `

{% if true %} yes {% endif %}

`, expected: `

yes

` }, { text: `

{% if false %} no {% endif %}

`, expected: `

` }, { text: '

{{- \'John\' -}}

', expected: '

John

' }, { text: '

{%- if true -%}yes{%- endif -%}

', expected: '

yes

' }, { text: '

{%- if false -%}no{%- endif -%}

', expected: '

' }, { text: '

{%- if true %} yes {% endif -%}

', expected: '

yes

' }, { text: '

{%- if false %} no {% endif -%}

', expected: '

' }, { text: '

{% if true -%} yes {%- endif %}

', expected: '

yes

' }, { text: '

{% if false -%} no {%- endif %}

', expected: '

' }, { text: '

{% if true -%} yes {% endif -%}

', expected: '

yes

' }, { text: '

{% if false -%} no {% endif -%}

', expected: '

' }, { text: '

{%- if true %} yes {%- endif %}

', expected: '

yes

' }, { text: '

{%- if false %} no {%- endif %}

', expected: '

' }, { text: `

{{- 'John' }}

`, expected: `

John

` }, { text: `

{%- if true %} yes {%- endif %}

`, expected: `

yes

` }, { text: `

{%- if false %} no {%- endif %}

`, expected: `

` }, { text: `

{{ 'John' -}}

`, expected: `

John

` }, { text: `

{% if true -%} yes {% endif -%}

`, expected: `

yes

` }, { text: `

{% if false -%} no {% endif -%}

`, expected: `

` }, { text: `

{%- if true %} yes {% endif -%}

`, expected: `

yes

` }, { text: `

{%- if false %} no {% endif -%}

`, expected: `

` }, { text: `

{% if true -%} yes {%- endif %}

`, expected: `

yes

` }, { text: `

{% if false -%} no {%- endif %}

`, expected: `

` }, { text: `

{{- 'John' -}}

`, expected: `

John

` }, { text: `

{%- if true -%} yes {%- endif -%}

`, expected: `

yes

` }, { text: `

{%- if false -%} no {%- endif -%}

`, expected: `

` }, { text: `

{{- 'John' -}}, {{- '30' -}}

`, expected: `

John,30

` }, { text: `

{%- if true -%} yes {%- endif -%}

`, expected: `

yes

` }, { text: `

{%- if false -%} no {%- endif -%}

`, expected: `

` }, { text: `

{{- 'John' -}} {{- '30' -}}

{{ 'John' -}} {{- '30' }} {{- 'John' }} {{ '30' -}}
`, expected: `

John30

John30 John 30
` }, { text: `
{%- if true -%} {%- if true -%}

{{- 'John' -}}

{%- endif -%} {%- endif -%}
`, expected: `

John

` }, { text: `
{% raw %} {%- if true -%}

{{- 'John' -}}

{%- endif -%} {% endraw %}
`, expected: `
{%- if true -%}

{{- 'John' -}}

{%- endif -%}
` } ] describe('Whitespace Control', function () { cases.forEach(item => it( item.text, async () => { const html = await liquid.parseAndRender(item.text) expect(html).to.equal(item.expected) } )) })