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:
parent
a818972637
commit
46f65d9adb
|
|
@ -268,6 +268,10 @@ defmodule PlausibleWeb.Live.GoalSettings.Form do
|
||||||
"""
|
"""
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def handle_info({:selection_made, %{submit_value: _prop}}, socket) do
|
||||||
|
{:noreply, socket}
|
||||||
|
end
|
||||||
|
|
||||||
def handle_event("switch-tab", _params, socket) do
|
def handle_event("switch-tab", _params, socket) do
|
||||||
{:noreply,
|
{:noreply,
|
||||||
assign(socket,
|
assign(socket,
|
||||||
|
|
|
||||||
|
|
@ -129,6 +129,13 @@ defmodule PlausibleWeb.Live.GoalSettings.FormTest do
|
||||||
|
|
||||||
refute element_exists?(html, ~s/a[phx-value-display-value="PLN - Polish Zloty"]/)
|
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"]/)
|
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
|
end
|
||||||
|
|
||||||
test "pageview combo works", %{conn: conn, site: site} do
|
test "pageview combo works", %{conn: conn, site: site} do
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue