mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-15 08:50:45 -07:00
snippets
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user