mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
Merge pull request #1750 from IevaGraz/fix/custom_tag_rendering
Fix for custom tag rendering
This commit is contained in:
+2
-1
@@ -54,7 +54,8 @@ module Liquid
|
|||||||
# of the `render_to_output_buffer` method will become the default and the `render`
|
# of the `render_to_output_buffer` method will become the default and the `render`
|
||||||
# method will be removed.
|
# method will be removed.
|
||||||
def render_to_output_buffer(context, output)
|
def render_to_output_buffer(context, output)
|
||||||
output << render(context)
|
render_result = render(context)
|
||||||
|
output << render_result if render_result
|
||||||
output
|
output
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -20,4 +20,13 @@ class TagUnitTest < Minitest::Test
|
|||||||
tag = Tag.parse("some_tag", "", Tokenizer.new(""), ParseContext.new)
|
tag = Tag.parse("some_tag", "", Tokenizer.new(""), ParseContext.new)
|
||||||
assert_equal('some_tag', tag.tag_name)
|
assert_equal('some_tag', tag.tag_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class CustomTag < Liquid::Tag
|
||||||
|
def render(_context); end
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_tag_render_to_output_buffer_nil_value
|
||||||
|
custom_tag = CustomTag.parse("some_tag", "", Tokenizer.new(""), ParseContext.new)
|
||||||
|
assert_equal('some string', custom_tag.render_to_output_buffer(Context.new, "some string"))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user