Testing Liveview partial

I have a partial form (_form.html.leex) that I am rendering on a page that is not a LiveView, <%= live_render(@conn, AppWeb.Live.ItemConfigForm, session: session_map) %>

I need to know how the LiveView interacts with some DOM events, so I can’t just use render_component/2 but using live/2 I don’t have a live path to provide. So how can I test this form?

I was in this situation today, although I already did in the past but forgot how to do it :slight_smile:
Not easy to figure out, since it is not mentioned in the module documentation.

You have to use live_isolated/3.

Credit: How to do "top-down" LiveView rendering tests of nested LiveComponents - #5 by shamanime

1 Like