As I have come to find while writing tests many themes can screw up the testing framework with < span > tags and what not inside the < a > tag. This can be solved by looking for the text directly inside the link element or nested within.

The following will look the same in the browser.

<a>foobar<a>
<a><span>foobar</span></a>

But only the first will work with the assertLink(), assertNoLink(), and clickLink() methods.

Files: 
CommentFileSizeAuthor
#1 855726-nested-text.patch2.14 KBboombatower
PASSED: [[SimpleTest]]: [MySQL] 22,126 pass(es). View

Comments

boombatower’s picture

Assigned:Unassigned» boombatower
Status:Active» Needs review
FileSize
2.14 KB
PASSED: [[SimpleTest]]: [MySQL] 22,126 pass(es). View
thedavidmeister’s picture

Version:7.x-dev» 8.x-dev
Assigned:boombatower» Unassigned
Status:Needs review» Needs work
Issue tags:+Needs tests

This is still an issue in D8.

Patch no longer applies in D7.

curl -0 https://drupal.org/files/issues/855726-nested-text.patch | git apply
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2189  100  2189    0     0   1815      0  0:00:01  0:00:01 --:--:--  2229
error: simpletest/drupal_web_test_case.php: No such file or directory

I feel like this XPath expression that assertLink(), assertNoLink() and clickLink() are all sharing could be centralised rather than duplicating it, but that might be out of scope for this issue.

Could we write tests for this? Assert links in some strings that we know should work but don't because of this bug?

#2094585: [meta] [experimental] Core review bonus for #2072647: #theme 'maintenance_page' should support render arrays in #content.

Version:8.0.x-dev» 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.