Loading core/includes/theme.inc +1 −1 Original line number Diff line number Diff line Loading @@ -1890,7 +1890,7 @@ function drupal_common_theme() { 'variables' => ['items' => [], 'title' => '', 'list_type' => 'ul', 'wrapper_attributes' => [], 'attributes' => [], 'empty' => NULL, 'context' => []], ], 'feed_icon' => [ 'variables' => ['url' => NULL, 'title' => NULL], 'variables' => ['url' => NULL, 'title' => NULL, 'attributes' => []], ], 'progress_bar' => [ 'variables' => ['label' => NULL, 'percent' => NULL, 'message' => NULL], Loading core/modules/system/tests/src/Kernel/Common/AddFeedTest.php +16 −0 Original line number Diff line number Diff line Loading @@ -99,4 +99,20 @@ public function testFeedIconEscaping() { $this->assertEquals('Subscribe to <>&"'', trim(strip_tags($text)), 'feed_icon template escapes reserved HTML characters.'); } /** * Tests that the rendered output contains specific attributes. */ public function testAttributeAdded(): void { $variables = [ '#theme' => 'feed_icon', '#url' => 'node/add/', '#title' => 'testing title', '#attributes' => ['title' => 'some title', 'class' => ['some-class']], ]; $rendered_output = (string) \Drupal::service('renderer')->renderRoot($variables); // Check if the class 'some-class' is present in the rendered output. $this->assertStringContainsString('some-class', $rendered_output, "The class 'some-class' should be present in the rendered output."); } } Loading
core/includes/theme.inc +1 −1 Original line number Diff line number Diff line Loading @@ -1890,7 +1890,7 @@ function drupal_common_theme() { 'variables' => ['items' => [], 'title' => '', 'list_type' => 'ul', 'wrapper_attributes' => [], 'attributes' => [], 'empty' => NULL, 'context' => []], ], 'feed_icon' => [ 'variables' => ['url' => NULL, 'title' => NULL], 'variables' => ['url' => NULL, 'title' => NULL, 'attributes' => []], ], 'progress_bar' => [ 'variables' => ['label' => NULL, 'percent' => NULL, 'message' => NULL], Loading
core/modules/system/tests/src/Kernel/Common/AddFeedTest.php +16 −0 Original line number Diff line number Diff line Loading @@ -99,4 +99,20 @@ public function testFeedIconEscaping() { $this->assertEquals('Subscribe to <>&"'', trim(strip_tags($text)), 'feed_icon template escapes reserved HTML characters.'); } /** * Tests that the rendered output contains specific attributes. */ public function testAttributeAdded(): void { $variables = [ '#theme' => 'feed_icon', '#url' => 'node/add/', '#title' => 'testing title', '#attributes' => ['title' => 'some title', 'class' => ['some-class']], ]; $rendered_output = (string) \Drupal::service('renderer')->renderRoot($variables); // Check if the class 'some-class' is present in the rendered output. $this->assertStringContainsString('some-class', $rendered_output, "The class 'some-class' should be present in the rendered output."); } }