Merge pull request #44585 from davekaro/remove_circle_void_element

Remove circle from HTML_VOID_ELEMENTS set.
This commit is contained in:
Jean Boussier 2022-03-02 20:26:45 +01:00 committed by GitHub
commit 13dd6f93c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

@ -45,7 +45,7 @@ class TagBuilder # :nodoc:
include CaptureHelper
include OutputSafetyHelper
HTML_VOID_ELEMENTS = %i(area base br col circle embed hr img input keygen link meta param source track wbr).to_set
HTML_VOID_ELEMENTS = %i(area base br col embed hr img input keygen link meta param source track wbr).to_set
SVG_SELF_CLOSING_ELEMENTS = %i(animate animateMotion animateTransform circle ellipse line path polygon polyline rect set stop use view).to_set
def initialize(view_context)

@ -21,13 +21,21 @@ def test_tag_builder
def test_tag_builder_void_tag
assert_equal "<br>", tag.br
assert_equal "<br class=\"some_class\">", tag.br(class: "some_class")
assert_equal "<svg><use href=\"#cool-icon\" /></svg>", tag.svg { tag.use("href" => "#cool-icon") }
end
def test_tag_builder_void_tag_with_forced_content
assert_equal "<br>some content</br>", tag.br("some content")
end
def test_tag_builder_self_closing_tag
assert_equal "<svg><use href=\"#cool-icon\" /></svg>", tag.svg { tag.use("href" => "#cool-icon") }
assert_equal "<svg><circle cx=\"5\" cy=\"5\" r=\"5\" /></svg>", tag.svg { tag.circle(cx: "5", cy: "5", r: "5") }
end
def test_tag_builder_self_closing_tag_with_content
assert_equal "<svg><circle><desc>A circle</desc></circle></svg>", tag.svg { tag.circle { tag.desc "A circle" } }
end
def test_tag_builder_is_singleton
assert_equal tag, tag
end