tablerow: Avoid accidental special case for constant nil cols (#1644)

It should behave the same as an expression that evaluates to nil
This commit is contained in:
Dylan Thacker-Smith
2022-10-25 10:21:03 -04:00
committed by GitHub
parent c99c93255d
commit 6ce4ec1011
2 changed files with 15 additions and 1 deletions
+14
View File
@@ -66,6 +66,20 @@ class TableRowTest < Minitest::Test
{ 'characters' => '' })
end
def test_cols_nil_constant_same_as_evaluated_nil_expression
expect = "<tr class=\"row1\">\n" \
"<td class=\"col1\">false</td>" \
"<td class=\"col2\">false</td>" \
"</tr>\n"
assert_template_result(expect,
"{% tablerow i in (1..2) cols:nil %}{{ tablerowloop.col_last }}{% endtablerow %}")
assert_template_result(expect,
"{% tablerow i in (1..2) cols:var %}{{ tablerowloop.col_last }}{% endtablerow %}",
{ "var" => nil })
end
def test_tablerow_loop_drop_attributes
template = <<~LIQUID.chomp
{% tablerow i in (1...2) %}