Test Livewire assertDispatched and assertSee after event dispatched
Hello,
I have the following field :
And I have the following test :
When I run my test, I have the following fails :
and
1. I don't understand why the first assertion fails and why the parameters aren't correct as I send the
$state
when I dispatch the event.
2. I don't understand why 22,12
is not in the HTML as when I test it in my browser, it works like a charm.Solution:Jump to solution
I answer to myself, I found a topic on Laracast for the second problem I have : https://laracasts.com/discuss/channels/livewire/livewire-testing-nested-components
For the first issue, I don't use the good syntax, which must be
->assertDispatched('updatedSelectedLicenses', selectedLicenses: [$license->id])
...1 Reply
Solution
I answer to myself, I found a topic on Laracast for the second problem I have : https://laracasts.com/discuss/channels/livewire/livewire-testing-nested-components
For the first issue, I don't use the good syntax, which must be
->assertDispatched('updatedSelectedLicenses', selectedLicenses: [$license->id])