Allow render to handle with and for correctly (#1193)

* Allow render to handle with and for correctly

* code improvements
This commit is contained in:
Mike Angell
2019-10-23 04:12:46 +10:00
committed by GitHub
parent e83b1e4159
commit 57c9cf64eb
2 changed files with 25 additions and 4 deletions
+18
View File
@@ -214,4 +214,22 @@ class RenderTagTest < Minitest::Test
assert_template_result("Product: Draft 151cm first index:1 Product: Element 155cm last index:2 ",
"{% render 'product' for products %}", "products" => [{ 'title' => 'Draft 151cm' }, { 'title' => 'Element 155cm' }])
end
def test_render_tag_for_drop
Liquid::Template.file_system = StubFileSystem.new(
'loop' => "{{ value.foo }}",
)
assert_template_result("123",
"{% render 'loop' for loop as value %}", "loop" => TestEnumerable.new)
end
def test_render_tag_with_drop
Liquid::Template.file_system = StubFileSystem.new(
'loop' => "{{ value }}",
)
assert_template_result("TestEnumerable",
"{% render 'loop' with loop as value %}", "loop" => TestEnumerable.new)
end
end