Skip to content

Conversation

Develog
Copy link

@Develog Develog commented Oct 15, 2025

Q A
Bug fix? no
New feature? yes
Deprecations? no
Documentation? yes
Issues no
License MIT

Next to this PR #2712 I wanted to add test assertion on dispatchBrowserEvent and not only on emited event.
I reuse same logic as the ComponentWithEmit.php.

$this->assertComponentDispatchEvent($testComponent->render(), 'browserEvent')
    ->withPayload(['amount' => 2, 'unit' => 'kg'])
    ->withPayloadSubset(['amount' => 2]) ;

$this->assertComponentNotDispatchEvent($testComponent->render(), 'otherBrowserEvent');

@Develog Develog force-pushed the feat/add-dispatch-browser-event-test branch from cba34d0 to ab52681 Compare October 15, 2025 06:02
@Develog Develog marked this pull request as ready for review October 15, 2025 06:06
@carsonbot carsonbot added Documentation Improvements or additions to documentation Feature New Feature LiveComponent Status: Needs Review Needs to be reviewed labels Oct 15, 2025
@Develog
Copy link
Author

Develog commented Oct 15, 2025

I'm asking myself if it's better to create a dedicated component that only have one action that dispatch browser event rather than reuse ComponentWithEmit.php

@smnandre
Copy link
Member

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation Improvements or additions to documentation Feature New Feature LiveComponent Status: Needs Review Needs to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants