Verified Commit 5923aeae authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3371937 by yash.rode, Abhijith S, smustgrave, fgm: Theme declaration...

Issue #3371937 by yash.rode, Abhijith S, smustgrave, fgm: Theme declaration and templates mismatch for feed_icon

(cherry picked from commit 01da0fd9)
parent 0bc782b1
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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],
+16 −0
Original line number Diff line number Diff line
@@ -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.");
  }

}