File tree Expand file tree Collapse file tree 3 files changed +17
-9
lines changed Expand file tree Collapse file tree 3 files changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -164,7 +164,7 @@ def new_line
164164
165165 def without_new_line
166166 self . class . new (
167- **deconstruct_keys ( [ ] ) . merge ( closing : closing . without_new_line )
167+ **deconstruct_keys ( [ ] ) . merge ( closing : closing & .without_new_line )
168168 )
169169 end
170170
@@ -253,6 +253,15 @@ def deconstruct_keys(keys)
253253 end
254254 end
255255
256+ def without_new_line
257+ self . class . new (
258+ **deconstruct_keys ( [ ] ) . merge (
259+ opening : closing . nil? ? opening . without_new_line : opening ,
260+ closing : closing &.without_new_line
261+ )
262+ )
263+ end
264+
256265 # The HTML-closing tag is responsible for new lines after the node.
257266 def new_line
258267 closing . nil? ? opening . new_line : closing &.new_line
Original file line number Diff line number Diff line change @@ -180,5 +180,12 @@ def test_breakable_on_char_data_white_space
180180
181181 assert_formatting ( source , expected )
182182 end
183+
184+ def test_self_closing_group
185+ source = "<link />\n <link />\n <meta />"
186+ expected = "<link />\n <link />\n <meta />\n "
187+
188+ assert_formatting ( source , expected )
189+ end
183190 end
184191end
Original file line number Diff line number Diff line change @@ -12,18 +12,10 @@ class TestCase < Minitest::Test
1212 def assert_formatting ( source , expected )
1313 formatted = SyntaxTree ::ERB . format ( source )
1414
15- if ( expected != formatted )
16- binding . irb if debug
17- end
18-
1915 assert_equal ( formatted , expected , "Failed first" )
2016
2117 formatted_twice = SyntaxTree ::ERB . format ( formatted )
2218
23- if ( expected != formatted_twice )
24- binding . irb if debug
25- end
26-
2719 assert_equal ( formatted_twice , expected , "Failed second" )
2820
2921 # Check that pretty_print works
You can’t perform that action at this time.
0 commit comments