Skip to content

Commit b8e20b6

Browse files
committed
fix specs
1 parent ddbff0c commit b8e20b6

File tree

6 files changed

+26
-13
lines changed

6 files changed

+26
-13
lines changed

app/views/decidim/extra_user_fields/_registration_form.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<h2 class="h4"><%= t(".signup.legend") %></h2>
44

55
<% if current_organization.activated_extra_field?(:date_of_birth) %>
6-
<div><%= f.date_field :date_of_birth, id: "user_date_of_birth" %></div>
6+
<div><%= f.date_field :date_of_birth %></div>
77
<% end %>
88

99
<% if current_organization.activated_extra_field?(:gender) %>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<% f.object.custom_select_fields_options.each do |field, options| %>
22
<div class="fieldset">
3-
<%= label_tag "user_select_fields_#{field}" do %>
3+
<%= label_tag f.field_id("select_fields_#{field}") do %>
44
<%= t("decidim.extra_user_fields.select_fields.#{field}.label", default: field.to_s.humanize) %>
55
<% if (help = t("decidim.extra_user_fields.select_fields.#{field}.description", default: "")).present? %>
66
<span class="help-text"><%= help %></span>
77
<% end %>
88

99
<%= select_tag "user[select_fields][#{field}]",
1010
options_for_select(options, f.object.select_fields[field]),
11-
id: "user_select_fields_#{field}" %>
11+
id: f.field_id("select_fields_#{field}") %>
1212
<% end %>
1313
</div>
1414
<% end %>

config/locales/fr.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,20 @@ fr:
8585
extra_user_fields:
8686
extra_user_fields_enabled: Activer les champs d'inscription personnalisés
8787
section: Champs d'inscription disponibles pour le formulaire d'inscription
88+
section_extras: Champs supplémentaires personnalisés
89+
section_extras_description: Si vous avez configuré des champs d'utilisateur
90+
supplémentaires, vous pouvez les gérer ici (Voir la section "Configuration
91+
via un initializer" dans le README du plugin).
8892
global:
8993
title: Activer / Désactiver les champs d'inscription personnalisés
9094
index:
9195
save: Sauvegarder
9296
title: Gérer les champs d'inscription personnalisés
97+
select_fields:
98+
participant_type:
99+
description: Ce champ est une liste de types de participants. L'utilisateur
100+
devra choisir un type de participant.
101+
label: Activer le champ type de participant
93102
update:
94103
failure: Une erreur est survenue lors de la mise à jour
95104
success: Les champs d'inscription ont été mis à jour avec succ§s
@@ -99,6 +108,8 @@ fr:
99108
61_or_more: 61 ou plus
100109
prefer_not_to_say: Préfère ne pas dire
101110
up_to_16: 16 ou moins
111+
errors:
112+
select_fields: Le champ "%{field}" n'est pas valide.
102113
genders:
103114
female: Femme
104115
male: Homme
@@ -109,6 +120,9 @@ fr:
109120
legend: Plus d'information
110121
underage: Je suis âgé de moins de %{limit} ans et j'accepte d'obtenir une
111122
autorisation parentale
123+
select_fields:
124+
participant_type:
125+
label: Activer le champ type de participant
112126
statutory_representative:
113127
inform:
114128
body: |

lib/decidim/extra_user_fields.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ module ExtraUserFields
4646
config_accessor :select_fields do
4747
{
4848
participant_type: {
49-
"" => "",
49+
# "" => "",
5050
"individual" => "decidim.extra_user_fields.participant_types.individual",
5151
"organization" => "decidim.extra_user_fields.participant_types.organization"
5252
}

spec/system/account_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
fill_in :user_personal_url, with: "https://example.org"
109109
fill_in :user_about, with: "A Serbian-American inventor, electrical engineer, mechanical engineer, physicist, and futurist."
110110

111-
fill_in :user_date_of_birth_date, with: "01/01/2000"
111+
fill_in_datepicker :user_date_of_birth_date, with: "01/01/2000"
112112
select "Other", from: :user_gender
113113
select "17 to 30", from: :user_age_range
114114
select "Argentina", from: :user_country
@@ -256,7 +256,7 @@
256256
fill_in :user_personal_url, with: "https://example.org"
257257
fill_in :user_about, with: "A Serbian-American inventor, electrical engineer, mechanical engineer, physicist, and futurist."
258258

259-
fill_in :user_date_of_birth_date, with: "01/01/2000"
259+
fill_in_datepicker :user_date_of_birth_date, with: "01/01/2000"
260260
select "Other", from: :user_gender
261261
select "17 to 30", from: :user_age_range
262262
select "Argentina", from: :user_country
@@ -318,7 +318,7 @@
318318
fill_in :user_personal_url, with: "https://example.org"
319319
fill_in :user_about, with: "A Serbian-American inventor, electrical engineer, mechanical engineer, physicist, and futurist."
320320

321-
fill_in :user_date_of_birth_date, with: "01/01/2000"
321+
fill_in_datepicker :user_date_of_birth_date, with: "01/01/2000"
322322
select "Other", from: :user_gender
323323
select "17 to 30", from: :user_age_range
324324
select "Argentina", from: :user_country

spec/system/registration_spec.rb

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ def fill_registration_form
1111
end
1212

1313
def fill_extra_user_fields
14-
fill_in :registration_user_date_of_birth_date, with: "01/01/2000"
14+
fill_in_datepicker :registration_user_date_of_birth_date, with: "01/01/2000"
1515
select "Other", from: :registration_user_gender
1616
select "17 to 30", from: :registration_user_age_range
1717
select "Argentina", from: :registration_user_country
18-
select "Individual", from: :registration_user_participant_type
18+
select "Individual", from: :registration_user_select_fields_participant_type
1919
fill_in :registration_user_postal_code, with: "00000"
2020
fill_in :registration_user_phone_number, with: "0123456789"
2121
fill_in :registration_user_location, with: "Cahors"
@@ -97,8 +97,7 @@ def fill_extra_user_fields
9797
expect(page).to have_content("Phone Number")
9898
expect(page).to have_content("Location")
9999
expect(page).to have_content("How old are you?")
100-
expect(page).to have_content("How do you identify?")
101-
expect(page).to have_content("Select your participant type")
100+
expect(page).to have_content("Are you participating as an individual, or officially on behalf of an organization?")
102101
end
103102
end
104103

@@ -165,8 +164,8 @@ def fill_extra_user_fields
165164
expect(page).to have_no_content("Postal code")
166165
expect(page).to have_no_content("Phone Number")
167166
expect(page).to have_no_content("Location")
168-
expect(page).to have_no_content("How do you identify?")
169-
expect(page).to have_no_content("Select your participant type")
167+
expect(page).to have_no_content("Which gender do you identify with?")
168+
expect(page).to have_no_content("Are you participating as an individual, or officially on behalf of an organization?")
170169
end
171170

172171
it "allows to create a new account" do

0 commit comments

Comments
 (0)