diff --git a/core/modules/simpletest/src/AssertContentTrait.php b/core/modules/simpletest/src/AssertContentTrait.php index 5a6c8c0..11c1392 100644 --- a/core/modules/simpletest/src/AssertContentTrait.php +++ b/core/modules/simpletest/src/AssertContentTrait.php @@ -300,7 +300,7 @@ protected function getAllOptions(\SimpleXMLElement $element) { protected function assertLink($label, $index = 0, $message = '', $group = 'Other') { // Cast MarkupInterface objects to string. $label = (string) $label; - $links = $this->xpath('//a[normalize-space(text())=:label]', [':label' => $label]); + $links = $this->xpath('//a[normalize-space(text())=:label]|//a[.//*[normalize-space(text())=:label]]', [':label' => $label]); $message = ($message ? $message : strtr('Link with label %label found.', ['%label' => $label])); return $this->assert(isset($links[$index]), $message, $group); } @@ -327,7 +327,7 @@ protected function assertLink($label, $index = 0, $message = '', $group = 'Other protected function assertNoLink($label, $message = '', $group = 'Other') { // Cast MarkupInterface objects to string. $label = (string) $label; - $links = $this->xpath('//a[normalize-space(text())=:label]', [':label' => $label]); + $links = $this->xpath('//a[normalize-space(text())=:label]|//a[.//*[normalize-space(text())=:label]]', [':label' => $label]); $message = ($message ? $message : SafeMarkup::format('Link with label %label not found.', ['%label' => $label])); return $this->assert(empty($links), $message, $group); } diff --git a/core/modules/simpletest/src/WebTestBase.php b/core/modules/simpletest/src/WebTestBase.php index 2491bc8..d4615b3 100644 --- a/core/modules/simpletest/src/WebTestBase.php +++ b/core/modules/simpletest/src/WebTestBase.php @@ -1799,7 +1799,7 @@ protected function handleForm(&$post, &$edit, &$upload, $submit, $form) { * Page contents on success, or FALSE on failure. */ protected function clickLink($label, $index = 0) { - return $this->clickLinkHelper($label, $index, '//a[normalize-space()=:label]'); + return $this->clickLinkHelper($label, $index, '//a[normalize-space(text())=:label]|//a[.//*[normalize-space(text())=:label]]'); } /** diff --git a/core/modules/views/tests/src/Functional/SearchIntegrationTest.php b/core/modules/views/tests/src/Functional/SearchIntegrationTest.php index f4daac7..258571b 100644 --- a/core/modules/views/tests/src/Functional/SearchIntegrationTest.php +++ b/core/modules/views/tests/src/Functional/SearchIntegrationTest.php @@ -144,7 +144,7 @@ public function testSearchIntegration() { * TRUE if the assertion succeeded, FALSE otherwise. */ protected function assertOneLink($label) { - $links = $this->xpath('//a[normalize-space(text())=:label]', [':label' => $label]); + $links = $this->xpath('//a[normalize-space(text())=:label]|//a[.//*[normalize-space(text())=:label]]', [':label' => $label]); $message = SafeMarkup::format('Link with label %label found once.', ['%label' => $label]); return $this->assert(isset($links[0]) && !isset($links[1]), $message); } diff --git a/core/modules/views_ui/src/Tests/DefaultViewsTest.php b/core/modules/views_ui/src/Tests/DefaultViewsTest.php index a709d1f..e1b6ef8 100644 --- a/core/modules/views_ui/src/Tests/DefaultViewsTest.php +++ b/core/modules/views_ui/src/Tests/DefaultViewsTest.php @@ -228,7 +228,7 @@ public function testPathDestination() { * failure. Failure also results in a failed assertion. */ public function clickViewsOperationLink($label, $unique_href_part) { - $links = $this->xpath('//a[normalize-space(text())=:label]', [':label' => $label]); + $links = $this->xpath('//a[normalize-space(text())=:label]|//a[.//*[normalize-space(text())=:label]]', [':label' => $label]); foreach ($links as $link_index => $link) { $position = strpos($link['href'], $unique_href_part); if ($position !== FALSE) {