You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<div><spanclass="foo">This is just an example.</span><spanclass="quux">More text:
<spanclass="value">Foo</span></span></div>
If for any reason it was important to check this HTML piece contains "More text: Foo", current implementation of havingTextContents (ie. havingTextContents(constainsString('More text: Foo')) would fail to do so. This is because currently it strictly checks the text contains expected substring including all the whitespace.
In order to deal with cases like the above, there could be a custom matcher added ignoring the whitespace.
The alternative way might be to change havingTextContents do the whitespace normalization magic. I don't think this would be nice, though. On the other hand, that would kind of be replicating the behaviour of browsers etc, that also treat multiple white space as a single one.
The text was updated successfully, but these errors were encountered:
This has been discovered in https://gerrit.wikimedia.org/r/#/c/348756/2/resources/templates.php.
There HTML being validated is generated from the template. For convenience it makes sense to have a bit complex HTML split into multiple lines.
Resulting HTML could then be something like:
If for any reason it was important to check this HTML piece contains "More text: Foo", current implementation of
havingTextContents
(ie.havingTextContents(constainsString('More text: Foo'))
would fail to do so. This is because currently it strictly checks the text contains expected substring including all the whitespace.In order to deal with cases like the above, there could be a custom matcher added ignoring the whitespace.
The alternative way might be to change
havingTextContents
do the whitespace normalization magic. I don't think this would be nice, though. On the other hand, that would kind of be replicating the behaviour of browsers etc, that also treat multiple white space as a single one.The text was updated successfully, but these errors were encountered: