Skip to content

Commit

Permalink
Merge branch 'master' into looker-studio
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertJoonas authored Jan 30, 2025
2 parents 1198323 + 86f3919 commit 334e146
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
8 changes: 7 additions & 1 deletion lib/plausible_web/live/components/modal.ex
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ defmodule PlausibleWeb.Live.Components.Modal do
"""

@test_preload_override? Mix.env() in [:test, :ce_test]

use PlausibleWeb, :live_component

alias Phoenix.LiveView
Expand Down Expand Up @@ -131,7 +133,11 @@ defmodule PlausibleWeb.Live.Components.Modal do

@impl true
def update(assigns, socket) do
preload? = Map.get(assigns, :preload?, true)
# NOTE: This is a workaround for @test_preload_override? being computed
# at build time, where Mix.env() is available. Otherwise, dialyzer
# complains.
preload_override? = :erlang.phash2(1, 1) == 0 and @test_preload_override?
preload? = preload_override? || Map.get(assigns, :preload?, true)

socket =
assign(socket,
Expand Down
2 changes: 1 addition & 1 deletion lib/plausible_web/live/goal_settings.ex
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ defmodule PlausibleWeb.Live.GoalSettings do
<div id="goal-settings-main">
<.flash_messages flash={@flash} />
<.live_component :let={modal_unique_id} module={Modal} id="goals-form-modal">
<.live_component :let={modal_unique_id} module={Modal} preload?={false} id="goals-form-modal">
<.live_component
module={PlausibleWeb.Live.GoalSettings.Form}
id={"goals-form-#{modal_unique_id}"}
Expand Down
12 changes: 0 additions & 12 deletions test/plausible_web/live/goal_settings_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -165,18 +165,6 @@ defmodule PlausibleWeb.Live.GoalSettingsTest do
refute html =~ "No goals found for this site. Please refine or"
end

test "Add Goal form view is rendered immediately, though hidden", %{conn: conn, site: site} do
{:ok, _goals} = setup_goals(site)
{_, html} = get_liveview(conn, site, with_html?: true)

assert html =~ "Add Goal for #{site.domain}"

assert element_exists?(
html,
~s/#goals-form-modal form[phx-submit="save-goal"]/
)
end

test "auto-configuring custom event goals", %{conn: conn, site: site} do
populate_stats(site, [
build(:event, name: "Signup"),
Expand Down

0 comments on commit 334e146

Please sign in to comment.