Looking at the LV testing docs, seemingly there’s no way to fire up, say, two phx-change
events and then match against a rendered HTML. For example, in a currency converter I’d like to change both amount and source currency before matching on a resulting text. However I’m wondering if it’s intentional so the tests would be atomic as possible?
When you call {:ok, view, html} = live(conn, "/my-path")
LiveViewTest spawns a connected view
process.
Then calling element(view, "#amount") |> render_change(value)
will send the view your change event via that element. If you ignore the rendered result from the first render_change/2
and send the view another change event via the second element element(view, "#source") |> render_change(value)
, the second result should match on the expected accumulation of both events.