analytics/test/plausible_web/live/props_settings_test.exs

178 lines
6.1 KiB
Elixir
Raw Normal View History

Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
defmodule PlausibleWeb.Live.PropsSettingsTest do
2023-07-27 17:46:32 +03:00
use PlausibleWeb.ConnCase, async: true
import Phoenix.LiveViewTest
import Plausible.Test.Support.HTML
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
describe "GET /:website/settings/properties" do
setup [:create_user, :log_in, :create_site]
test "lists props for the site and renders links", %{conn: conn, site: site} do
{:ok, site} = Plausible.Props.allow(site, ["amount", "logged_in", "is_customer"])
conn = get(conn, "/#{site.domain}/settings/properties")
resp = html_response(conn, 200)
assert resp =~ "Attach Custom Properties"
assert element_exists?(
resp,
~s|a[href="https://plausible.io/docs/custom-props/introduction"]|
)
assert resp =~ "amount"
assert resp =~ "logged_in"
assert resp =~ "is_customer"
end
test "lists props with disallow actions", %{conn: conn, site: site} do
{:ok, site} = Plausible.Props.allow(site, ["amount", "logged_in", "is_customer"])
conn = get(conn, "/#{site.domain}/settings/properties")
resp = html_response(conn, 200)
for p <- site.allowed_event_props do
assert element_exists?(
resp,
~s/button[phx-click="disallow-prop"][phx-value-prop=#{p}]#disallow-prop-#{p}/
)
end
end
2023-07-27 17:46:32 +03:00
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
test "if no props are allowed, a proper info is displayed", %{conn: conn, site: site} do
conn = get(conn, "/#{site.domain}/settings/properties")
resp = html_response(conn, 200)
assert resp =~ "No properties configured for this site"
end
2023-07-27 17:46:32 +03:00
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
test "if props are enabled, no info about missing props is displayed", %{
conn: conn,
site: site
} do
{:ok, site} = Plausible.Props.allow(site, ["amount", "logged_in", "is_customer"])
conn = get(conn, "/#{site.domain}/settings/properties")
resp = html_response(conn, 200)
refute resp =~ "No properties configured for this site"
end
2023-07-27 17:46:32 +03:00
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
test "add property button is rendered", %{conn: conn, site: site} do
conn = get(conn, "/#{site.domain}/settings/properties")
resp = html_response(conn, 200)
assert element_exists?(resp, ~s/button[phx-click="add-prop"]/)
end
2023-07-27 17:46:32 +03:00
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
test "search props input is rendered", %{conn: conn, site: site} do
conn = get(conn, "/#{site.domain}/settings/properties")
resp = html_response(conn, 200)
assert element_exists?(resp, ~s/input[type="text"]#filter-text/)
assert element_exists?(resp, ~s/form[phx-change="filter"]#filter-form/)
end
2023-07-27 17:46:32 +03:00
end
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
# validating input
# clicking suggestions fills out input
# adding props
# error when reached props limit
# clearserror when fixed input
# removal
# removal shows confirmation
# allow existing props: shows/hides
# after adding all suggestions no allow existing props
2023-07-27 17:46:32 +03:00
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
describe "PropsSettings live view" do
setup [:create_user, :log_in, :create_site]
2023-07-27 17:46:32 +03:00
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
test "allows prop removal", %{conn: conn, site: site} do
{:ok, site} = Plausible.Props.allow(site, ["amount", "logged_in"])
{lv, html} = get_liveview(conn, site, with_html?: true)
2023-07-27 17:46:32 +03:00
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
assert html =~ "amount"
assert html =~ "logged_in"
2023-07-27 17:46:32 +03:00
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
html = lv |> element(~s/button#disallow-prop-amount/) |> render_click()
2023-07-27 17:46:32 +03:00
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
refute html =~ "amount"
assert html =~ "logged_in"
2023-07-27 17:46:32 +03:00
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
html = get(conn, "/#{site.domain}/settings/properties") |> html_response(200)
2023-07-27 17:46:32 +03:00
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
refute html =~ "amount"
assert html =~ "logged_in"
end
2023-07-27 17:46:32 +03:00
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
test "allows props filtering / search", %{conn: conn, site: site} do
{:ok, site} = Plausible.Props.allow(site, ["amount", "logged_in", "is_customer"])
{lv, html} = get_liveview(conn, site, with_html?: true)
2023-07-27 17:46:32 +03:00
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
assert html =~ to_string("amount")
assert html =~ to_string("logged_in")
assert html =~ to_string("is_customer")
2023-07-27 17:46:32 +03:00
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
html = type_into_search(lv, "is_customer")
2023-07-27 17:46:32 +03:00
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
refute html =~ to_string("amount")
refute html =~ to_string("logged_in")
assert html =~ to_string("is_customer")
end
2023-07-27 17:46:32 +03:00
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
test "allows resetting filter text via backspace icon", %{conn: conn, site: site} do
{:ok, site} = Plausible.Props.allow(site, ["amount", "logged_in", "is_customer"])
{lv, html} = get_liveview(conn, site, with_html?: true)
2023-07-27 17:46:32 +03:00
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
refute element_exists?(html, ~s/svg[phx-click="reset-filter-text"]#reset-filter/)
2023-07-27 17:46:32 +03:00
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
html = type_into_search(lv, to_string("is_customer"))
2023-07-27 17:46:32 +03:00
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
assert element_exists?(html, ~s/svg[phx-click="reset-filter-text"]#reset-filter/)
2023-07-27 17:46:32 +03:00
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
html = lv |> element(~s/svg#reset-filter/) |> render_click()
2023-07-27 17:46:32 +03:00
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
assert html =~ to_string("is_customer")
assert html =~ to_string("amount")
assert html =~ to_string("logged_in")
end
2023-07-27 17:46:32 +03:00
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
test "allows resetting filter text via no match link", %{conn: conn, site: site} do
lv = get_liveview(conn, site)
html = type_into_search(lv, "Definitely this is not going to render any matches")
2023-07-27 17:46:32 +03:00
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
assert html =~ "No properties found for this site. Please refine or"
assert html =~ "reset your search"
2023-07-27 17:46:32 +03:00
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
assert element_exists?(html, ~s/a[phx-click="reset-filter-text"]#reset-filter-hint/)
html = lv |> element(~s/a#reset-filter-hint/) |> render_click()
2023-07-27 17:46:32 +03:00
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
refute html =~ "No properties found for this site. Please refine or"
end
2023-07-27 17:46:32 +03:00
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
test "clicking Add Property button renders the form view", %{conn: conn, site: site} do
lv = get_liveview(conn, site)
html = lv |> element(~s/button[phx-click="add-prop"]/) |> render_click()
2023-07-27 17:46:32 +03:00
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
assert html =~ "Add Property for #{site.domain}"
2023-07-27 17:46:32 +03:00
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
assert element_exists?(
html,
~s/div#props-form form[phx-submit="allow-prop"][phx-click-away="cancel-allow-prop"]/
)
end
2023-07-27 17:46:32 +03:00
end
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
defp get_liveview(conn, site, opts \\ []) do
2023-07-27 17:46:32 +03:00
conn = assign(conn, :live_module, PlausibleWeb.Live.PropsSettings)
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
{:ok, lv, html} = live(conn, "/#{site.domain}/settings/properties")
2023-07-27 17:46:32 +03:00
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
if Keyword.get(opts, :with_html?) do
{lv, html}
else
lv
end
2023-07-27 17:46:32 +03:00
end
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
defp type_into_search(lv, text) do
2023-07-27 17:46:32 +03:00
lv
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
|> element("form#filter-form")
2023-07-27 17:46:32 +03:00
|> render_change(%{
Props Settings UI to match Goals Settings (#3322) * Add hint to creatable ComboBoxes without suggestions available * Load external resources once in funnel settings * Load external resources once in goal settings * Make Custom Props Settings UI match Goal Settings * Remove unnecessary goals query This should be done only once in the live view * Remove funnels feature flag * fixup * Make the modal scrollable * By default, focus first suggestion for creatables * Add sample props to seeds * Load all suggestions asynchronously, unless `Mix.env == :test` * ComboBox: Fix inconsistent suggestions We require "Create ..." element to be only focused when there are no suggestions available. This causes some issues, depending on the state, the least focusable index might be either 0 ("Create...") or 1. This patch addresses all the quirks with focus. * Fix ComboBox max results message So that AlpineJS doesn't think it's a focusable option. * Keep the state up to date when changing props * Update seeds with sensible prop names * Make escape work for closing combobox suggestions Co-authored-by: Uku Taht <Uku.taht@gmail.com> * Revert "Make escape work for closing combobox suggestions" This reverts commit 306866d2a15d652eaa0327f1b96a302de5e426e5. @ukutaht unfortunately this makes it impossible to select an suggestion. * Revert "Revert "Make escape work for closing combobox suggestions"" This reverts commit 4844857812d21ea1233fe3b9ae6f95364c945a14. * Make ESC great again * Improve readability --------- Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2023-09-13 15:55:29 +03:00
"_target" => ["filter-text"],
"filter-text" => "#{text}"
2023-07-27 17:46:32 +03:00
})
end
end