Skip to content

Commit 3a16087

Browse files
committed
temp render tests
1 parent 64ea12f commit 3a16087

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

test/integration/tags/snippet_test.rb

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,23 @@ def test_render_inline_snippet_with_doc_tag
115115
assert_template_result(expected, template)
116116
end
117117

118+
def test_render_inline_snippet_with_evaluated_assign
119+
template = <<~LIQUID.strip
120+
{% snippet input %}
121+
<h1>{{ greeting }}</h1>
122+
{% endsnippet %}
123+
124+
{%- assign greeting = "hello" | upcase -%}
125+
{%- render input, greeting: greeting -%}
126+
LIQUID
127+
expected = <<~OUTPUT
128+
129+
<h1>HELLO</h1>
130+
OUTPUT
131+
132+
assert_template_result(expected, template)
133+
end
134+
118135
def test_render_inline_snippet_with_multiple_arguments
119136
template = <<~LIQUID.strip
120137
{% snippet input %}
@@ -448,4 +465,59 @@ def test_render_snippets_as_arguments
448465

449466
# assert_template_result(expected, template)
450467
# end
468+
469+
# def test_render_inline_snippet_forloop
470+
# template = <<~LIQUID.strip
471+
# {% snippet item %}
472+
# <li>{{ forloop.index }}: {{ item }}</li>
473+
# {% endsnippet %}
474+
475+
# {% assign items = "A,B,C" | split: "," %}
476+
# {%- render item for items -%}
477+
# LIQUID
478+
# expected = <<~OUTPUT
479+
480+
# <li>1: A</li>
481+
482+
# <li>2: B</li>
483+
484+
# <li>3: C</li>
485+
# OUTPUT
486+
487+
# assert_template_result(expected, template)
488+
# end
489+
490+
# def test_render_inline_snippet_with
491+
# template = <<~LIQUID.strip
492+
# {% snippet header %}
493+
# <div>{{ header }}</div>
494+
# {% endsnippet %}
495+
496+
# {% assign product = "Apple" %}
497+
# {%- render header with product -%}
498+
# LIQUID
499+
# expected = <<~OUTPUT
500+
501+
# <div>Apple</div>
502+
# OUTPUT
503+
504+
# assert_template_result(expected, template)
505+
# end
506+
507+
# def test_render_inline_snippet_alias
508+
# template = <<~LIQUID.strip
509+
# {% snippet product_card %}
510+
# <div class="product">{{ item }}</div>
511+
# {% endsnippet %}
512+
513+
# {% assign featured = "Apple" %}
514+
# {%- render product_card with featured as item -%}
515+
# LIQUID
516+
# expected = <<~OUTPUT
517+
518+
# <div class="product">Apple</div>
519+
# OUTPUT
520+
521+
# assert_template_result(expected, template)
522+
# end
451523
end

0 commit comments

Comments
 (0)