Commit 6a68f82d531266bed60e5a804f6d58fb5eb5ad15
1 parent
50723d96
Exists in
master
and in
5 other branches
corrections: Add Brazil as default value and disable country field when email is gov
Signed-off-by: Gabriela Navarro <navarro1703@gmail.com> Signed-off-by: Luciano Prestes <lucianopcbr@gmail.com>
Showing
2 changed files
with
31 additions
and
1 deletions
Show diff stats
features/user_registration.feature
@@ -103,3 +103,26 @@ Feature: User Registration | @@ -103,3 +103,26 @@ Feature: User Registration | ||
103 | And I go to /profile/maria | 103 | And I go to /profile/maria |
104 | Then I should not see "Complete Profile" | 104 | Then I should not see "Complete Profile" |
105 | 105 | ||
106 | + @selenium-fixme | ||
107 | + Scenario: When the user press incomplete percentage link,he must be redirect to his edit profile page | ||
108 | + Given the following users | ||
109 | + | login | name | email | country | state | city | | ||
110 | + | maria | Maria Silva | maria@example.com | Brazil | DF | Brasilia | | ||
111 | + When I am logged in as "maria" | ||
112 | + And I follow "Complete your profile" | ||
113 | + Then I should see "Profile settings" | ||
114 | + | ||
115 | + @selenium | ||
116 | + Scenario: The country select box from the registration form should be selected Brazil by default | ||
117 | + Given I go to /account/signup | ||
118 | + Then I should see "Brazil" within "#profile_data_country" | ||
119 | + | ||
120 | + @selenium | ||
121 | + Scenario: The country select box should enable/disable if the email has/hasnt gov suffix | ||
122 | + Given I go to /account/signup | ||
123 | + And I select "Barbados" from "profile_data[country]" | ||
124 | + And I fill in "e-Mail" with "maria@tse.gov.br" | ||
125 | + And I should see "Brazil" within "#profile_data_country" | ||
126 | + And I fill in "e-Mail" with "maria@tse.com.br" | ||
127 | + And I select "Barbados" from "profile_data[country]" | ||
128 | + Then I should see "Barbados" within "#profile_data_country" |
public/mpog-user-validations.js
@@ -19,14 +19,19 @@ function put_brazil_based_on_email(){ | @@ -19,14 +19,19 @@ function put_brazil_based_on_email(){ | ||
19 | var suffixes = ['gov.br', 'jus.br', 'leg.br', 'mp.br']; | 19 | var suffixes = ['gov.br', 'jus.br', 'leg.br', 'mp.br']; |
20 | var value = this.value; | 20 | var value = this.value; |
21 | var input_object = this; | 21 | var input_object = this; |
22 | + var gov_suffix = false; | ||
22 | 23 | ||
23 | suffixes.each(function(suffix){ | 24 | suffixes.each(function(suffix){ |
24 | var has_suffix = new RegExp("(.*)"+suffix+"$", "i"); | 25 | var has_suffix = new RegExp("(.*)"+suffix+"$", "i"); |
25 | 26 | ||
26 | - if( has_suffix.test(value) ) | 27 | + if( has_suffix.test(value) ) { |
28 | + gov_suffix = true; | ||
27 | jQuery("#profile_data_country").val("BR"); | 29 | jQuery("#profile_data_country").val("BR"); |
30 | + } | ||
28 | }); | 31 | }); |
29 | 32 | ||
33 | + jQuery("#profile_data_country").prop('disabled', gov_suffix); | ||
34 | + | ||
30 | check_reactivate_account(value, input_object) | 35 | check_reactivate_account(value, input_object) |
31 | } | 36 | } |
32 | 37 | ||
@@ -48,6 +53,8 @@ jQuery(document).ready(function(){ | @@ -48,6 +53,8 @@ jQuery(document).ready(function(){ | ||
48 | validate_email_format | 53 | validate_email_format |
49 | ); | 54 | ); |
50 | 55 | ||
56 | + jQuery('#profile_data_country').val("BR"); | ||
57 | + | ||
51 | jQuery("#user_email").blur( | 58 | jQuery("#user_email").blur( |
52 | put_brazil_based_on_email | 59 | put_brazil_based_on_email |
53 | ); | 60 | ); |