Skip to content

Commit

Permalink
Fix how component html is loaded for livewire 3 and new assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
christophrumpel committed Sep 29, 2023
1 parent 6678f87 commit 463c13c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/CustomLivewireAssertionsMixin.php
Expand Up @@ -154,7 +154,7 @@ public function assertMethodWiredToEvent(): Closure
return function (string $method, string $event) {
PHPUnit::assertMatchesRegularExpression(
'/wire:'.preg_quote($event, '/').'(\.[a-zA-Z0-9\-]+)*=(?<q>"|\')'.$method.'(\s*\(.+\)\s*)?\s*(\k\'q\')/',
$this->stripOutInitialData($this->lastRenderedDom)
$this->html()
);

return $this;
Expand All @@ -169,7 +169,7 @@ public function assertMethodNotWiredToEvent(): Closure
return function (string $method, string $event) {
PHPUnit::assertDoesNotMatchRegularExpression(
'/wire:'.preg_quote($event, '/').'(\.[a-zA-Z0-9\-]+)*=(?<q>"|\')'.$method.'(\s*\(.+\)\s*)?\s*(\k\'q\')/',
$this->stripOutInitialData($this->lastRenderedDom)
$this->html()
);

return $this;
Expand All @@ -184,7 +184,7 @@ public function assertMethodWiredToEventWithoutModifiers(): Closure
return function (string $method, string $event) {
PHPUnit::assertMatchesRegularExpression(
'/wire:'.preg_quote($event, '/').'=(?<q>"|\')'.$method.'(\s*\(.+\)\s*)?\s*(\k\'q\')/',
$this->stripOutInitialData($this->lastRenderedDom)
$this->html()
);

return $this;
Expand All @@ -199,7 +199,7 @@ public function assertMethodNotWiredToEventWithoutModifiers(): Closure
return function (string $method, string $event) {
PHPUnit::assertDoesNotMatchRegularExpression(
'/wire:'.preg_quote($event, '/').'=(?<q>"|\')'.$method.'(\s*\(.+\)\s*)?\s*(\k\'q\')/',
$this->stripOutInitialData($this->lastRenderedDom)
$this->html()
);

return $this;
Expand Down

0 comments on commit 463c13c

Please sign in to comment.