test: add tests for custom field labels
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
3bfb7dd09c
commit
a6f6f402af
2 changed files with 99 additions and 0 deletions
|
|
@ -135,6 +135,34 @@ defmodule MvWeb.JoinLiveTest do
|
|||
end
|
||||
end
|
||||
|
||||
describe "join field labels" do
|
||||
@tag role: :unauthenticated
|
||||
test "renders custom field name as label for custom field IDs", %{conn: conn} do
|
||||
{:ok, settings} = Membership.get_settings()
|
||||
system_actor = Mv.Helpers.SystemActor.get_system_actor()
|
||||
|
||||
{:ok, custom_field} =
|
||||
Membership.create_custom_field(
|
||||
%{
|
||||
name: "Preferred Pronouns",
|
||||
value_type: :string
|
||||
},
|
||||
actor: system_actor
|
||||
)
|
||||
|
||||
{:ok, _} =
|
||||
Membership.update_settings(settings, %{
|
||||
join_form_enabled: true,
|
||||
join_form_field_ids: ["email", custom_field.id],
|
||||
join_form_field_required: %{"email" => true, custom_field.id => false}
|
||||
})
|
||||
|
||||
{:ok, view, _html} = live(conn, "/join")
|
||||
|
||||
assert has_element?(view, "label[for='join-field-#{custom_field.id}'] .label-text", custom_field.name)
|
||||
end
|
||||
end
|
||||
|
||||
defp enable_join_form(enabled) do
|
||||
{:ok, settings} = Membership.get_settings()
|
||||
{:ok, _} = Membership.update_settings(settings, %{join_form_enabled: enabled})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue