mirror of
https://github.com/plausible/analytics.git
synced 2024-12-24 18:12:44 +03:00
CombBox bugfix: stale spinner on creatable options selection (#3713)
This commit is contained in:
parent
6ca4eaf5e2
commit
36a8b36382
@ -243,7 +243,7 @@ defmodule PlausibleWeb.Live.Components.ComboBox do
|
|||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
x-ref={"dropdown-#{@ref}-option-#{@idx}"}
|
x-ref={"dropdown-#{@ref}-option-#{@idx}"}
|
||||||
x-on:click="selectionInProgress = true"
|
x-on:click={not @creatable && "selectionInProgress = true"}
|
||||||
phx-click={select_option(@ref, @submit_value, @display_value)}
|
phx-click={select_option(@ref, @submit_value, @display_value)}
|
||||||
phx-value-submit-value={@submit_value}
|
phx-value-submit-value={@submit_value}
|
||||||
phx-value-display-value={@display_value}
|
phx-value-display-value={@display_value}
|
||||||
|
@ -274,6 +274,20 @@ defmodule PlausibleWeb.Live.Components.ComboBoxTest do
|
|||||||
"input[type=hidden][name=some_submit_name][value=\"my new option\"]"
|
"input[type=hidden][name=some_submit_name][value=\"my new option\"]"
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "selectionInProgress doesn't apply when no server roundtrip is needed", %{conn: conn} do
|
||||||
|
{:ok, lv, html} = live_isolated(conn, CreatableView, session: %{})
|
||||||
|
regular_option = find(html, "li#dropdown-test-creatable-component-option-1 a")
|
||||||
|
|
||||||
|
assert Floki.attribute(regular_option, "x-on:click") == ["selectionInProgress = true"]
|
||||||
|
|
||||||
|
creatable_option =
|
||||||
|
lv
|
||||||
|
|> type_into_combo("test-creatable-component", "my new option")
|
||||||
|
|> find("input[type=hidden][name=some_submit_name][value=\"my new option\"]")
|
||||||
|
|
||||||
|
assert Floki.attribute(creatable_option, "x-on:click") == []
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "async suggestions" do
|
describe "async suggestions" do
|
||||||
|
Loading…
Reference in New Issue
Block a user