From 86a4f076d4d668e9b8ec8791015cdd779332b7aa Mon Sep 17 00:00:00 2001 From: Mark Carver Date: Wed, 28 May 2014 21:59:04 -0500 Subject: [PATCH] Issue #552478 by Mark Carver, pwolanin, sun, effulgentsia, dropcube, ohnobinki, samj, Wim Leers: Fixed Remove "self-closing" and restrict no "closing tags" to only void elements in html_tag. --- .../src/Tests/Common/RenderElementTypesTest.php | 32 ++++++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/core/modules/system/src/Tests/Common/RenderElementTypesTest.php b/core/modules/system/src/Tests/Common/RenderElementTypesTest.php index 15a1904..2a2e6b2 100644 --- a/core/modules/system/src/Tests/Common/RenderElementTypesTest.php +++ b/core/modules/system/src/Tests/Common/RenderElementTypesTest.php @@ -89,22 +89,42 @@ function testContainer() { * Tests system #type 'html_tag'. */ function testHtmlTag() { - // Test auto-closure meta tag generation. + // Test void element. $this->assertElements(array( '#type' => 'html_tag', '#tag' => 'meta', + '#value' => 'ignored', + '#value_prefix' => 'ignored', + '#value_suffix' => 'ignored', '#attributes' => array( 'name' => 'description', 'content' => 'Drupal test', ), - ), '' . "\n", "#type 'html_tag' auto-closure meta tag generation"); + ), '' . "\n", "#type 'html_tag', void element renders properly"); - // Test title tag generation. + // Test non-void element. $this->assertElements(array( '#type' => 'html_tag', - '#tag' => 'title', - '#value' => 'title test', - ), "title test\n", "#type 'html_tag' title tag generation"); + '#tag' => 'section', + '#value' => 'value', + '#value_prefix' => 'value_prefix|', + '#value_suffix' => '|value_suffix', + '#attributes' => array( + 'class' => array('unicorns'), + ), + ), '
value_prefix|value|value_suffix
' . "\n", "#type 'html_tag', non-void element renders properly"); + + // Test empty void element tag. + $this->assertElements(array( + '#type' => 'html_tag', + '#tag' => 'link', + ), "\n", "#type 'html_tag' empty void element renders properly"); + + // Test empty non-void element tag. + $this->assertElements(array( + '#type' => 'html_tag', + '#tag' => 'section', + ), "
\n", "#type 'html_tag' empty non-void element renders properly"); } } -- 1.9.1