LiveIsolatedComponent.Spy (live_isolated_component v0.1.0)
Collection of utilities to create spies for handle_event
and
handle_info
spies.
Link to this section Summary
Functions
Checks if any event was registered at all.
Returns all the events in the spy.
Creates an spy for a handle_event.
Creates an spy for a handle_info.
Returns the last event registered in the spy.
Link to this section Functions
Link to this function
any_event_received?(map)
Checks if any event was registered at all.
Link to this function
events(map)
Returns all the events in the spy.
Link to this function
handle_event(default_impl \\ fn _e, _p, s -> {:noreply, s} end)
Creates an spy for a handle_event.
handle_event_spy = Spy.handle_event()
{:ok, view, _html} = live_isolated_component(SomeComponent, handle_event: handle_event_spy.callback)
view
|> element("button")
|> render_click()
assert Spy.any_event_received?(handle_event_spy)
Link to this function
handle_info(default_impl \\ fn _e, s -> {:noreply, s} end)
Creates an spy for a handle_info.
handle_info_spy = Spy.handle_info()
{:ok, view, _html} = live_isolated_component(SomeComponent, handle_info: handle_info_spy.callback)
view
|> element("button")
|> render_click()
assert Spy.any_event_received?(handle_info_spy)
Link to this function
last_event(map)
Returns the last event registered in the spy.