diff --git a/features/user_profile_edition.feature b/features/user_profile_edition.feature index 4d4c677..b31d302 100644 --- a/features/user_profile_edition.feature +++ b/features/user_profile_edition.feature @@ -10,6 +10,11 @@ Feature: Institution Field And I check "MpogSoftwarePlugin" And I press "Save changes" And feature "skip_new_user_email_confirmation" is enabled on environment + And I go to /admin/features/manage_fields + And I check "person_fields_country_active" + And I check "person_fields_state_active" + And I check "person_fields_city_active" + And I press "Save changes" And I go to /account/logout And Institutions has initial default values on database And the following public institutions @@ -47,4 +52,18 @@ Feature: Institution Field Scenario: Verify text information to use governmental e-mail Given I am on josesilva's control panel And I follow "Edit Profile" - Then I should see "If you work in a public agency use your government e-Mail" \ No newline at end of file + Then I should see "If you work in a public agency use your government e-Mail" + + @selenium + Scenario: Verify if field 'city' is shown when Brazil is selected + Given I am on josesilva's control panel + And I follow "Edit Profile" + Then I should see "City" + + @selenium + Scenario: Verify if field 'city' does not appear when Brazil is not selected as country + Given I am on josesilva's control panel + When I follow "Edit Profile" + And I select "United States" from "profile_data_country" + And I sleep for 1 seconds + Then I should not see "City" diff --git a/public/mpog-user-validations.js b/public/mpog-user-validations.js index a4dc920..c5ae7d5 100644 --- a/public/mpog-user-validations.js +++ b/public/mpog-user-validations.js @@ -38,6 +38,13 @@ }); } + function hide_city(){ + jQuery("#city_field").parent().parent().parent().hide(); + } + function show_city(){ + jQuery("#city_field").parent().parent().parent().show(); + } + function replace_state_with_input() { replace_with(input_select); } @@ -53,6 +60,14 @@ setInput : function() { replace_state_with_input(); + }, + + setHideCity : function(){ + hide_city(); + }, + + setShowCity : function(){ + show_city(); } } } @@ -255,8 +270,10 @@ jQuery("#profile_data_country").change(function(){ if( this.value == "BR" && selectFieldChoices.actualFieldIsInput() ) { selectFieldChoices.setSelect(); + selectFieldChoices.setShowCity(); } else { selectFieldChoices.setInput(); + selectFieldChoices.setHideCity(); } }); -- libgit2 0.21.2