diff --git a/core/tests/Drupal/Tests/Core/Render/Element/HtmlTagTest.php b/core/tests/Drupal/Tests/Core/Render/Element/HtmlTagTest.php index 40bb427..7092087 100644 --- a/core/tests/Drupal/Tests/Core/Render/Element/HtmlTagTest.php +++ b/core/tests/Drupal/Tests/Core/Render/Element/HtmlTagTest.php @@ -102,6 +102,103 @@ public function providerPreRenderHtmlTag() { ]; $tags[] = [$element, "

value1value2

\n"]; + // Ensure svg elements. + $element = [ + '#tag' => 'rect', + '#attributes' => [ + 'width' => 25, + 'height' => 25, + 'x' => 5, + 'y' => 10, + ], + ]; + $tags[] = [$element, '' . "\n"]; + + $element = [ + '#tag' => 'circle', + '#attributes' => [ + 'cx' => 100, + 'cy' => 100, + 'r' => 100, + ], + ]; + $tags[] = [$element, '' . "\n"]; + + $element = [ + '#tag' => 'polygon', + '#attributes' => [ + 'points' => '60,20 100,40 100,80 60,100 20,80 20,40', + ], + ]; + $tags[] = [$element, '' . "\n"]; + + $element = [ + '#tag' => 'ellipse', + '#attributes' => [ + 'cx' => 60, + 'cy' => 60, + 'rx' => 50, + 'ry' => 25, + ], + ]; + $tags[] = [$element, '' . "\n"]; + + $element = [ + '#tag' => 'use', + '#attributes' => [ + 'x' => 50, + 'y' => 10, + 'width' => 50, + 'height' => 50, + ], + ]; + $tags[] = [$element, '' . "\n"]; + + $element = [ + '#tag' => 'path', + '#attributes' => [ + 'd' => 'M 100 100 L 300 100 L 200 300 z', + 'fill' => 'orange', + 'stroke' => 'black', + 'stroke-width' => 3, + ], + ]; + $tags[] = [$element, '' . "\n"]; + + $element = [ + '#tag' => 'stop', + '#attributes' => [ + 'offset' => '5%', + 'stop-color' => '#F60' + ], + ]; + $tags[] = [$element, '' . "\n"]; + + // Nested svg elements. + $element = [ + '#tag' => 'linearGradient', + '#value' => NULL, + [ + [ + '#type' => 'html_tag', + '#tag' => 'stop', + '#attributes' => [ + 'offset' => '5%', + 'stop-color' => '#F60' + ], + ], + [ + '#type' => 'html_tag', + '#tag' => 'stop', + '#attributes' => [ + 'offset' => '95%', + 'stop-color' => '#FF6' + ], + ], + ], + ]; + $tags[] = [$element, '' . "\n"]; + return $tags; }