Serabe / live_isolated_component

Testing Live Components in isolation
MIT License
24 stars 4 forks source link

Event target #38

Open MMore opened 3 months ago

MMore commented 3 months ago

Hello,

nice little library !!

Is there a way to handle components that have a phx-target set?

 <.input
        type="search"
        id={@id <> "-input"}
        name="search_phrase"
        value={@search_phrase}
        phx-target={@myself}
        phx-change="search"
      />

An assert_handle_event(view, "search") does not work in this case....

Serabe commented 2 months ago

No. When there is a phx-target is mostly an opaque box. If that is happening it is because it is inside your component and thus you should be testing your component's behaviour, not who is receiving the event.