From db720e3ea84bac70562c7296bec465d2f67eb9f7 Mon Sep 17 00:00:00 2001 From: Dave Long <dave@longwaveconsulting.com> Date: Sat, 25 Nov 2023 11:06:26 +0000 Subject: [PATCH] Issue #3403573 by quietone: Fix attribute related words in tests --- core/misc/cspell/dictionary.txt | 3 --- .../Functional/FilterHtmlImageSecureTest.php | 6 +++--- .../tests/src/Kernel/Theme/FunctionsTest.php | 20 +++++++++---------- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/core/misc/cspell/dictionary.txt b/core/misc/cspell/dictionary.txt index d84d2d730201..6214b875c42d 100644 --- a/core/misc/cspell/dictionary.txt +++ b/core/misc/cspell/dictionary.txt @@ -161,7 +161,6 @@ classtype cldr clearfix clicksorter -clist closethick cnenzrgre codesniffer @@ -824,7 +823,6 @@ sloopal smacss smalldatetime somecompany -somelinks sortablejs sourceediting spacebar @@ -921,7 +919,6 @@ tcomment templating tercera testajax -testattribute testblock testbody testbot diff --git a/core/modules/filter/tests/src/Functional/FilterHtmlImageSecureTest.php b/core/modules/filter/tests/src/Functional/FilterHtmlImageSecureTest.php index 3aa0428cfe21..091976736391 100644 --- a/core/modules/filter/tests/src/Functional/FilterHtmlImageSecureTest.php +++ b/core/modules/filter/tests/src/Functional/FilterHtmlImageSecureTest.php @@ -45,7 +45,7 @@ protected function setUp(): void { 'filter_html' => [ 'status' => 1, 'settings' => [ - 'allowed_html' => '<img src testattribute> <a>', + 'allowed_html' => '<img src test-attribute> <a>', ], ], 'filter_autop' => [ @@ -134,7 +134,7 @@ public function testImageSource() { $comment[] = $image . ':'; // Hash the image source in a custom test attribute, because it might // contain characters that confuse XPath. - $comment[] = '<img src="' . $image . '" testattribute="' . hash('sha256', $image) . '" />'; + $comment[] = '<img src="' . $image . '" test-attribute="' . hash('sha256', $image) . '" />'; } $edit = [ 'comment_body[0][value]' => implode("\n", $comment), @@ -143,7 +143,7 @@ public function testImageSource() { $this->submitForm($edit, 'Save'); foreach ($images as $image => $converted) { $found = FALSE; - foreach ($this->xpath('//img[@testattribute="' . hash('sha256', $image) . '"]') as $element) { + foreach ($this->xpath('//img[@test-attribute="' . hash('sha256', $image) . '"]') as $element) { $found = TRUE; if ($converted == $red_x_image) { $this->assertEquals($red_x_image, $element->getAttribute('src')); diff --git a/core/modules/system/tests/src/Kernel/Theme/FunctionsTest.php b/core/modules/system/tests/src/Kernel/Theme/FunctionsTest.php index 2936c3ca79fd..1d8824bdbb5f 100644 --- a/core/modules/system/tests/src/Kernel/Theme/FunctionsTest.php +++ b/core/modules/system/tests/src/Kernel/Theme/FunctionsTest.php @@ -119,7 +119,7 @@ public function testItemList() { [ '#markup' => 'c', 'child_list' => [ - '#attributes' => ['id' => 'clist'], + '#attributes' => ['id' => 'c-list'], 'ca', [ '#markup' => 'cb', @@ -155,7 +155,7 @@ public function testItemList() { $inner_cb .= '<li>cbb</li>'; $inner_cb .= '</ul></div>'; - $inner_c = '<div class="item-list"><ul id="clist">'; + $inner_c = '<div class="item-list"><ul id="c-list">'; $inner_c .= '<li>ca</li>'; $inner_c .= '<li class="item-class-cb">cb' . $inner_cb . '</li>'; $inner_c .= '<li>cc</li>'; @@ -196,7 +196,7 @@ public function testLinks() { // Verify that a list of links is properly rendered. $variables = []; - $variables['attributes'] = ['id' => 'somelinks']; + $variables['attributes'] = ['id' => 'some_links']; $variables['links'] = [ 'a link' => [ 'title' => 'A <link>', @@ -226,7 +226,7 @@ public function testLinks() { ]; $expected_links = ''; - $expected_links .= '<ul id="somelinks">'; + $expected_links .= '<ul id="some_links">'; $expected_links .= '<li><a href="' . Url::fromUri('base:a/link')->toString() . '">' . Html::escape('A <link>') . '</a></li>'; $expected_links .= '<li>' . Html::escape('Plain "text"') . '</li>'; $expected_links .= '<li><span class="unescaped">' . Html::escape('potentially unsafe text that <should> be escaped') . '</span></li>'; @@ -266,7 +266,7 @@ public function testLinks() { 'class' => ['a/class'], ]; $expected_links = ''; - $expected_links .= '<ul id="somelinks">'; + $expected_links .= '<ul id="some_links">'; $expected_links .= '<li><a href="' . Url::fromUri('base:a/link')->toString() . '">' . Html::escape('A <link>') . '</a></li>'; $expected_links .= '<li><span class="a/class">' . Html::escape('Plain "text"') . '</span></li>'; $expected_links .= '<li><span class="unescaped">' . Html::escape('potentially unsafe text that <should> be escaped') . '</span></li>'; @@ -282,7 +282,7 @@ public function testLinks() { \Drupal::currentUser()->setAccount(new UserSession(['uid' => 1])); $variables['set_active_class'] = TRUE; $expected_links = ''; - $expected_links .= '<ul id="somelinks">'; + $expected_links .= '<ul id="some_links">'; $expected_links .= '<li><a href="' . Url::fromUri('base:a/link')->toString() . '">' . Html::escape('A <link>') . '</a></li>'; $expected_links .= '<li><span class="a/class">' . Html::escape('Plain "text"') . '</span></li>'; $expected_links .= '<li><span class="unescaped">' . Html::escape('potentially unsafe text that <should> be escaped') . '</span></li>'; @@ -317,7 +317,7 @@ public function testIndexedKeyedLinks() { // Verify that a list of links is properly rendered. $variables = []; - $variables['attributes'] = ['id' => 'somelinks']; + $variables['attributes'] = ['id' => 'some_links']; $variables['links'] = [ [ 'title' => 'A <link>', @@ -347,7 +347,7 @@ public function testIndexedKeyedLinks() { ]; $expected_links = ''; - $expected_links .= '<ul id="somelinks">'; + $expected_links .= '<ul id="some_links">'; $expected_links .= '<li><a href="' . Url::fromUri('base:a/link')->toString() . '">' . Html::escape('A <link>') . '</a></li>'; $expected_links .= '<li>' . Html::escape('Plain "text"') . '</li>'; $expected_links .= '<li><span class="unescaped">' . Html::escape('potentially unsafe text that <should> be escaped') . '</span></li>'; @@ -387,7 +387,7 @@ public function testIndexedKeyedLinks() { 'class' => ['a/class'], ]; $expected_links = ''; - $expected_links .= '<ul id="somelinks">'; + $expected_links .= '<ul id="some_links">'; $expected_links .= '<li><a href="' . Url::fromUri('base:a/link')->toString() . '">' . Html::escape('A <link>') . '</a></li>'; $expected_links .= '<li><span class="a/class">' . Html::escape('Plain "text"') . '</span></li>'; $expected_links .= '<li><span class="unescaped">' . Html::escape('potentially unsafe text that <should> be escaped') . '</span></li>'; @@ -403,7 +403,7 @@ public function testIndexedKeyedLinks() { \Drupal::currentUser()->setAccount(new UserSession(['uid' => 1])); $variables['set_active_class'] = TRUE; $expected_links = ''; - $expected_links .= '<ul id="somelinks">'; + $expected_links .= '<ul id="some_links">'; $expected_links .= '<li><a href="' . Url::fromUri('base:a/link')->toString() . '">' . Html::escape('A <link>') . '</a></li>'; $expected_links .= '<li><span class="a/class">' . Html::escape('Plain "text"') . '</span></li>'; $expected_links .= '<li><span class="unescaped">' . Html::escape('potentially unsafe text that <should> be escaped') . '</span></li>'; -- GitLab