mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-28 22:55:12 -07:00
Fix FrozenError for blank case tag with multiple expression when tag (#1340)
This commit is contained in:
@@ -22,8 +22,11 @@ module Liquid
|
|||||||
body = new_body
|
body = new_body
|
||||||
body = @blocks.last.attachment while parse_body(body, tokens)
|
body = @blocks.last.attachment while parse_body(body, tokens)
|
||||||
@blocks.each do |condition|
|
@blocks.each do |condition|
|
||||||
condition.attachment.remove_blank_strings if blank?
|
body = condition.attachment
|
||||||
condition.attachment.freeze
|
unless body.frozen?
|
||||||
|
body.remove_blank_strings if blank?
|
||||||
|
body.freeze
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -213,6 +213,11 @@ class StandardTagTest < Minitest::Test
|
|||||||
assert_template_result('', code, 'condition' => 'something else')
|
assert_template_result('', code, 'condition' => 'something else')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_case_when_comma_and_blank_body
|
||||||
|
code = '{% case condition %}{% when 1, 2 %} {% assign r = "result" %} {% endcase %}{{ r }}'
|
||||||
|
assert_template_result('result', code, 'condition' => 2)
|
||||||
|
end
|
||||||
|
|
||||||
def test_assign
|
def test_assign
|
||||||
assert_template_result('variable', '{% assign a = "variable"%}{{a}}')
|
assert_template_result('variable', '{% assign a = "variable"%}{{a}}')
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user