Commit bccb79104e9ed31bcb2a7684148b78567025b6e3

Authored by Fabio Teixeira
1 parent 9198bbb9

correcoes_aderencia: Add message of institution not found and email, city tests

Signed-off-by: Fabio Teixeira <fabio1079@gmail.com>
Signed-off-by: Luciano Prestes <lucianopcbr@gmail.com>
features/user_profile_edition.feature
@@ -35,7 +35,7 @@ Feature: Institution Field @@ -35,7 +35,7 @@ Feature: Institution Field
35 And I follow "Add new institution" 35 And I follow "Add new institution"
36 And I press "Create my account" 36 And I press "Create my account"
37 Then José da Silva's account is activated 37 Then José da Silva's account is activated
38 - 38 +
39 @selenium 39 @selenium
40 Scenario: Add more then one instituion on profile editor 40 Scenario: Add more then one instituion on profile editor
41 Given I am on josesilva's control panel 41 Given I am on josesilva's control panel
@@ -53,17 +53,25 @@ Feature: Institution Field @@ -53,17 +53,25 @@ Feature: Institution Field
53 Given I am on josesilva's control panel 53 Given I am on josesilva's control panel
54 And I follow "Edit Profile" 54 And I follow "Edit Profile"
55 Then I should see "If you work in a public agency use your government e-Mail" 55 Then I should see "If you work in a public agency use your government e-Mail"
56 - 56 +
57 @selenium 57 @selenium
58 Scenario: Verify if field 'city' is shown when Brazil is selected 58 Scenario: Verify if field 'city' is shown when Brazil is selected
59 Given I am on josesilva's control panel 59 Given I am on josesilva's control panel
60 And I follow "Edit Profile" 60 And I follow "Edit Profile"
61 Then I should see "City" 61 Then I should see "City"
62 - 62 +
63 @selenium 63 @selenium
64 Scenario: Verify if field 'city' does not appear when Brazil is not selected as country 64 Scenario: Verify if field 'city' does not appear when Brazil is not selected as country
65 Given I am on josesilva's control panel 65 Given I am on josesilva's control panel
66 When I follow "Edit Profile" 66 When I follow "Edit Profile"
67 And I select "United States" from "profile_data_country" 67 And I select "United States" from "profile_data_country"
  68 + Then I should not see "City" within ".type-text"
  69 +
  70 + @selenium
  71 + Scenario: Show message of institution not found
  72 + Given I am on josesilva's control panel
  73 + And I follow "Edit Profile"
  74 + And I fill in "input_institution" with "Some Nonexistent Institution"
68 And I sleep for 1 seconds 75 And I sleep for 1 seconds
69 - Then I should not see "City" 76 + Then I should see "No institution found"
  77 +
public/mpog-user-validations.js
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
8 // Get the initial state html 8 // Get the initial state html
9 var input_select = jQuery("#state_field").parent().html(); 9 var input_select = jQuery("#state_field").parent().html();
10 var old_value = jQuery("#state_field").val(); 10 var old_value = jQuery("#state_field").val();
  11 + var city_parent_div = jQuery("#city_field").parent().parent().parent();
11 12
12 function replace_with(html) { 13 function replace_with(html) {
13 var parent_div = jQuery("#state_field").parent(); 14 var parent_div = jQuery("#state_field").parent();
@@ -39,10 +40,11 @@ @@ -39,10 +40,11 @@
39 } 40 }
40 41
41 function hide_city(){ 42 function hide_city(){
42 - jQuery("#city_field").parent().parent().parent().hide(); 43 + city_parent_div.addClass("mpog_hidden_field");
43 } 44 }
  45 +
44 function show_city(){ 46 function show_city(){
45 - jQuery("#city_field").parent().parent().parent().show(); 47 + city_parent_div.removeClass("mpog_hidden_field");
46 } 48 }
47 49
48 function replace_state_with_input() { 50 function replace_state_with_input() {
public/style.css
1 -.mpog_hidden_field{  
2 - display: none; 1 +.mpog_hidden_field {
  2 + display: none;
3 } 3 }
4 4
5 #signup-form small#secondary-email-balloon , 5 #signup-form small#secondary-email-balloon ,
@@ -116,4 +116,5 @@ @@ -116,4 +116,5 @@
116 height: 20px; 116 height: 20px;
117 background: #fff; 117 background: #fff;
118 border: solid 1px #000; 118 border: solid 1px #000;
119 -}  
120 \ No newline at end of file 119 \ No newline at end of file
  120 +}
  121 +
views/person_editor_extras.html.erb
@@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
17 <% end %> 17 <% end %>
18 </div> 18 </div>
19 19
20 - <%= content_tag(:div, _("The searched institution does not exist"), :id=>"institution_empty_ajax_message", :class=>"errorExplanation hide-field") %> 20 + <%= content_tag(:div, _("No institution found"), :id=>"institution_empty_ajax_message", :class=>"errorExplanation hide-field") %>
21 <%= link_to(_("Add new institution"), "#", :class=>'button with-text icon-add', :id => 'add_new_institution') %> 21 <%= link_to(_("Add new institution"), "#", :class=>'button with-text icon-add', :id => 'add_new_institution') %>
22 22
23 <%= hidden_field_tag("user[institution_ids][]", "", :class => 'user_institutions') %> 23 <%= hidden_field_tag("user[institution_ids][]", "", :class => 'user_institutions') %>