File tree 2 files changed +19
-4
lines changed 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -330,11 +330,15 @@ def visit_tag(node)
330
330
if node . value [ :dynamic_attributes ] . old
331
331
parts << PlainPart . new ( "%div" ) if parts . empty?
332
332
333
- dynamic = parse_attributes ( node . value [ :dynamic_attributes ] . old )
334
- parts << if dynamic . is_a? ( LiteralHashValue )
335
- PlainPart . new ( dynamic . value )
333
+ if ::Haml ::AttributeParser . available?
334
+ dynamic = parse_attributes ( node . value [ :dynamic_attributes ] . old )
335
+ parts << if dynamic . is_a? ( LiteralHashValue )
336
+ PlainPart . new ( dynamic . value )
337
+ else
338
+ HashAttributesPart . new ( dynamic )
339
+ end
336
340
else
337
- HashAttributesPart . new ( dynamic )
341
+ parts << PlainPart . new ( node . value [ :dynamic_attributes ] . old )
338
342
end
339
343
end
340
344
Original file line number Diff line number Diff line change @@ -121,6 +121,17 @@ def test_long_declaration_before_text
121
121
HAML
122
122
end
123
123
124
+ def test_long_declaration_before_text_without_parser
125
+ long = "a" * 80
126
+
127
+ ::Haml ::AttributeParser . stub ( :available? , false ) do
128
+ assert_format ( "%button{ data: { current: #{ long } } } foo" , <<~HAML )
129
+ %button{ data: { current: #{ long } } }
130
+ foo
131
+ HAML
132
+ end
133
+ end
134
+
124
135
def test_quotes_in_strings
125
136
assert_format ( "%div{title: 'escape \" quotes'}" )
126
137
end
You can’t perform that action at this time.
0 commit comments