Fix for custom tag rendering

This commit is contained in:
Ieva Grazuleviciute
2023-10-20 11:42:54 +03:00
parent e3dcc75ab5
commit 407a8e5b0f
2 changed files with 11 additions and 1 deletions
+2 -1
View File
@@ -54,7 +54,8 @@ module Liquid
# of the `render_to_output_buffer` method will become the default and the `render`
# method will be removed.
def render_to_output_buffer(context, output)
output << render(context)
render_result = render(context)
output << render_result if render_result
output
end
+9
View File
@@ -20,4 +20,13 @@ class TagUnitTest < Minitest::Test
tag = Tag.parse("some_tag", "", Tokenizer.new(""), ParseContext.new)
assert_equal('some_tag', tag.tag_name)
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