This commit is contained in:
Josh Faigan
2024-09-19 12:03:43 -04:00
parent b233b3d081
commit ffe48869be
6 changed files with 94 additions and 1 deletions
+46
View File
@@ -0,0 +1,46 @@
# frozen_string_literal: true
require 'test_helper'
class SnippetTest < Minitest::Test
include Liquid
def xtest_valid_inline_snippet
template = <<~LIQUID.strip
{% snippet "input" %}
Hey
{% endsnippet %}
LIQUID
expected = ''
assert_template_result(expected, template)
end
def xtest_invalid_inline_snippet
template = <<~LIQUID.strip
{% snippet input %}
Hey
{% endsnippet %}
LIQUID
expected = "Syntax Error in 'snippet' - Valid syntax: snippet [quoted string]"
assert_match_syntax_error(expected, template)
end
def test_render_inline_snippet
template = <<~LIQUID.strip
{% snippet "input" %}
Hey
{% endsnippet %}
{%- render "input" %}{% render "input" %}
LIQUID
expected = <<~OUTPUT.strip
HeyHey
OUTPUT
assert_template_result(expected, template, partials: {
'input' => 'Hey',
})
end
end