Skip to content

Commit 60bb79c

Browse files
committed
Merge branch 'main' of github.com-private:sinnbeck/laravel-dom-assertions into main
2 parents 8f80a10 + c598d0d commit 60bb79c

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

src/Support/Normalize.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ public static function class(string $class): array
2020

2121
public static function text(string $text)
2222
{
23-
return trim($text);
23+
return preg_replace(['/\v+/', '/\s+/'], ['', ' '], trim($text));
2424
}
2525
}

tests/DomTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,13 @@
132132
});
133133
});
134134

135+
it('can match text content with duplicate spaces and vertical whitespace', function () {
136+
$this->get('nesting')
137+
->assertElementExists('p.foo.bar', function (AssertElement $element) {
138+
$element->has('text', 'Foo Bar');
139+
});
140+
});
141+
135142
it('can match a class no matter the order', function () {
136143
$this->get('nesting')
137144
->assertElementExists(function (AssertElement $element) {

tests/views/nesting.blade.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
<li x-data="foobar"></li>
2323
</ul>
2424
</div>
25+
<p class="foo bar">
26+
Foo
27+
<span>Bar</span>
28+
</p>
2529
</div>
2630
</body>
27-
</html>
31+
</html>

0 commit comments

Comments
 (0)