From bccb79104e9ed31bcb2a7684148b78567025b6e3 Mon Sep 17 00:00:00 2001 From: Fabio Teixeira Date: Mon, 13 Oct 2014 15:43:15 -0300 Subject: [PATCH] correcoes_aderencia: Add message of institution not found and email, city tests --- features/user_profile_edition.feature | 16 ++++++++++++---- public/mpog-user-validations.js | 6 ++++-- public/style.css | 7 ++++--- views/person_editor_extras.html.erb | 2 +- 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/features/user_profile_edition.feature b/features/user_profile_edition.feature index b31d302..9e13618 100644 --- a/features/user_profile_edition.feature +++ b/features/user_profile_edition.feature @@ -35,7 +35,7 @@ Feature: Institution Field And I follow "Add new institution" And I press "Create my account" Then José da Silva's account is activated - + @selenium Scenario: Add more then one instituion on profile editor Given I am on josesilva's control panel @@ -53,17 +53,25 @@ Feature: Institution Field 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" - + @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" + Then I should not see "City" within ".type-text" + + @selenium + Scenario: Show message of institution not found + Given I am on josesilva's control panel + And I follow "Edit Profile" + And I fill in "input_institution" with "Some Nonexistent Institution" And I sleep for 1 seconds - Then I should not see "City" + Then I should see "No institution found" + diff --git a/public/mpog-user-validations.js b/public/mpog-user-validations.js index c5ae7d5..428b0bf 100644 --- a/public/mpog-user-validations.js +++ b/public/mpog-user-validations.js @@ -8,6 +8,7 @@ // Get the initial state html var input_select = jQuery("#state_field").parent().html(); var old_value = jQuery("#state_field").val(); + var city_parent_div = jQuery("#city_field").parent().parent().parent(); function replace_with(html) { var parent_div = jQuery("#state_field").parent(); @@ -39,10 +40,11 @@ } function hide_city(){ - jQuery("#city_field").parent().parent().parent().hide(); + city_parent_div.addClass("mpog_hidden_field"); } + function show_city(){ - jQuery("#city_field").parent().parent().parent().show(); + city_parent_div.removeClass("mpog_hidden_field"); } function replace_state_with_input() { diff --git a/public/style.css b/public/style.css index cc4dfec..3c514d4 100644 --- a/public/style.css +++ b/public/style.css @@ -1,5 +1,5 @@ -.mpog_hidden_field{ - display: none; +.mpog_hidden_field { + display: none; } #signup-form small#secondary-email-balloon , @@ -116,4 +116,5 @@ height: 20px; background: #fff; border: solid 1px #000; -} \ No newline at end of file +} + diff --git a/views/person_editor_extras.html.erb b/views/person_editor_extras.html.erb index fe7c1f3..3b319b4 100644 --- a/views/person_editor_extras.html.erb +++ b/views/person_editor_extras.html.erb @@ -17,7 +17,7 @@ <% end %> - <%= content_tag(:div, _("The searched institution does not exist"), :id=>"institution_empty_ajax_message", :class=>"errorExplanation hide-field") %> + <%= content_tag(:div, _("No institution found"), :id=>"institution_empty_ajax_message", :class=>"errorExplanation hide-field") %> <%= link_to(_("Add new institution"), "#", :class=>'button with-text icon-add', :id => 'add_new_institution') %> <%= hidden_field_tag("user[institution_ids][]", "", :class => 'user_institutions') %> -- libgit2 0.21.2