I've noticed a problem when asserting the text of an element that contains duplicate spaces and vertical whitespace:
<div>
<p class="foobar">
Foo
<span>Bar</span>
</p>
</div>
$this->assertElementExists('p.foobar', fn ($el) => $el->has('text', 'Foo Bar'));
The assertion fails because the normalised text is:
I started adjusting Normalize::text() to replace the offending characters, but it felt like the wrong approach.
I wondered if allowing the user to supply a function to use for comparison could be a potential solution?