Make sure `:selection_made` is handled in `GoalSettings.Form`

That was a bit unepexcted.. normally `handle_info` is injected
by the LiveView use macro and it discards any message gracefully.
After switching to `use PlausibleWeb, :live_view` we're also
using `PlausibleWeb.Live.Flash` that happens to inject its own receive
clause for closing the flash. Which then renders the original,
overridable, `handle_info` catch-all obsolete.
This commit is contained in:
Adam Rutkowski 2024-01-09 12:11:03 +01:00
parent a818972637
commit 46f65d9adb
2 changed files with 11 additions and 0 deletions

View File

@ -268,6 +268,10 @@ defmodule PlausibleWeb.Live.GoalSettings.Form do
"""
end
def handle_info({:selection_made, %{submit_value: _prop}}, socket) do
{:noreply, socket}
end
def handle_event("switch-tab", _params, socket) do
{:noreply,
assign(socket,

View File

@ -129,6 +129,13 @@ defmodule PlausibleWeb.Live.GoalSettings.FormTest do
refute element_exists?(html, ~s/a[phx-value-display-value="PLN - Polish Zloty"]/)
assert element_exists?(html, ~s/a[phx-value-display-value="EUR - Euro"]/)
lv
|> element("#dropdown-currency_input-option-1 a")
|> render_click()
# make sure combo's {:selection_made, ...} message is received
render(lv)
end
test "pageview combo works", %{conn: conn, site: site} do