working with default parsing for args

This commit is contained in:
Josh Faigan
2024-09-27 12:29:03 -04:00
parent 30ea917a38
commit 98a69c80ef
4 changed files with 59 additions and 7 deletions
+33
View File
@@ -71,4 +71,37 @@ class SnippetTest < Minitest::Test
assert_template_result(expected, template)
end
def test_render_inline_snippet_with_argument
# This passes whether or not we have the new or old SYNTAX
template = <<~LIQUID.strip
{% snippet "input" |type, value| %}
<input type="{{ type }}" />
{% endsnippet %}
{%- render "input", type: "text" -%}
LIQUID
expected = <<~OUTPUT
<input type="text" />
OUTPUT
assert_template_result(expected, template)
end
def test_render_inline_snippet_with_multiple_arguments
template = <<~LIQUID.strip
{% snippet "input" |type, value| %}
<input type="{{ type }}" value="{{ value }}" />
{% endsnippet %}
{%- render "input", type: "text", value: "Hello" -%}
LIQUID
expected = <<~OUTPUT
<input type="text" value="Hello" />
OUTPUT
assert_template_result(expected, template)
end
end