Skip to content

Commit

Permalink
mix format
Browse files Browse the repository at this point in the history
  • Loading branch information
SteffenDE committed Jan 27, 2025
1 parent df82b86 commit e419029
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
17 changes: 10 additions & 7 deletions lib/phoenix_live_view/test/client_proxy.ex
Original file line number Diff line number Diff line change
Expand Up @@ -491,13 +491,16 @@ defmodule Phoenix.LiveViewTest.ClientProxy do
"""

:warn ->
IO.warn("""
#{String.trim(error)}
You can change this to raise and fail your test instead of warning
by passing `on_error: :raise` to `Phoenix.LiveViewTest.live/3` or
`Phoenix.LiveViewTest.live_isolated/3`.
""", [])
IO.warn(
"""
#{String.trim(error)}
You can change this to raise and fail your test instead of warning
by passing `on_error: :raise` to `Phoenix.LiveViewTest.live/3` or
`Phoenix.LiveViewTest.live_isolated/3`.
""",
[]
)
end

{:noreply, state}
Expand Down
3 changes: 3 additions & 0 deletions test/phoenix_live_view/integrations/live_view_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ defmodule Phoenix.LiveView.LiveViewTest do
{:ok, view, _html} = live(conn, "/duplicate-id", on_error: :raise)
render(view)
end

assert catch_exit(fun.())
assert_receive {:EXIT, _pid, {exception, _}}
assert Exception.message(exception) =~ "Duplicate id found while testing LiveView: a"
Expand Down Expand Up @@ -428,6 +429,7 @@ defmodule Phoenix.LiveView.LiveViewTest do
Phoenix.LiveViewTest.Support.DuplicateIdLive,
on_error: :raise
)

# errors are detected asynchronously, so we need to render again for the message to be processed
render(view)
end
Expand All @@ -447,6 +449,7 @@ defmodule Phoenix.LiveView.LiveViewTest do
Phoenix.LiveViewTest.Support.DynamicDuplicateComponentLive,
on_error: :raise
)

view |> element("button", "Toggle duplicate LC") |> render_click()
render(view)
end
Expand Down

0 comments on commit e419029

Please sign in to comment.