LiveIsolatedComponent (live_isolated_component v0.1.0)

Functions for testing LiveView stateful components in isolation easily.

Link to this section Summary

Functions

Updates the assigns of the component.

Updates the key in assigns of the component.

Renders the given component in isolation and live so you can tested like you would test any LiveView.

Link to this section Functions

Link to this function

live_assign(view, keyword_or_map)

Updates the assigns of the component.

{:ok, view, _html} = live_isolated_component(SomeComponent, assigns: %{description: "blue"})

live_assign(view, %{description: "red"})
Link to this function

live_assign(view, key, value)

Updates the key in assigns of the component.

{:ok, view, _html} = live_isolated_component(SomeComponent, assigns: %{description: "blue"})

live_assign(view, :description, "red")
Link to this macro

live_isolated_component(module, opts \\ %{})

(macro)

Renders the given component in isolation and live so you can tested like you would test any LiveView.

It accepts the following options:

  • :assigns accepts a map of assigns for the component.
  • :handle_event accepts a handler for the handle_event callback in the LiveView.
  • :handle_info accepts a handler for the handle_info callback in the LiveView.
  • :slots accepts different slot descriptors.