Skip to content

Commit

Permalink
update regex + tests (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmanase committed Mar 16, 2024
1 parent 52af84c commit 2a7ac82
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/CustomLivewireAssertionsMixin.php
Expand Up @@ -251,7 +251,7 @@ public function assertContainsLivewireComponent(): Closure
$componentHaystackView = file_get_contents($this->lastState->getView()->getPath());

PHPUnit::assertMatchesRegularExpression(
'/@livewire\(\''.$component.'\'|<livewire\:'.$component.'/',
'/@livewire\(\s*\''.$component.'\'|<livewire\:'.$component.'/',
$componentHaystackView
);

Expand Down
1 change: 1 addition & 0 deletions tests/AssertionsTest.php
Expand Up @@ -338,6 +338,7 @@ public function it_checks_if_it_does_not_see_string_before_other_string(): void
public function it_checks_if_it_sees_a_blade_directive(): void
{
Livewire::test(LivewireTestComponentC::class)
->assertContainsLivewireComponent(LivewireTestComponentA::class)
->assertContainsLivewireComponent(LivewireTestComponentB::class);
}

Expand Down
5 changes: 4 additions & 1 deletion tests/resources/views/livewire-test-component-c.php
@@ -1,3 +1,6 @@
<div>
@livewire('tests.components.livewire-test-component-b')
@livewire('tests.components.livewire-test-component-a')
@livewire(
'tests.components.livewire-test-component-b'
)
</div>

0 comments on commit 2a7ac82

Please sign in to comment.