diff --git a/features/user_registration.feature b/features/user_registration.feature index 7594dd2..a42bec5 100644 --- a/features/user_registration.feature +++ b/features/user_registration.feature @@ -103,3 +103,26 @@ Feature: User Registration And I go to /profile/maria Then I should not see "Complete Profile" + @selenium-fixme + Scenario: When the user press incomplete percentage link,he must be redirect to his edit profile page + Given the following users + | login | name | email | country | state | city | + | maria | Maria Silva | maria@example.com | Brazil | DF | Brasilia | + When I am logged in as "maria" + And I follow "Complete your profile" + Then I should see "Profile settings" + + @selenium + Scenario: The country select box from the registration form should be selected Brazil by default + Given I go to /account/signup + Then I should see "Brazil" within "#profile_data_country" + + @selenium + Scenario: The country select box should enable/disable if the email has/hasnt gov suffix + Given I go to /account/signup + And I select "Barbados" from "profile_data[country]" + And I fill in "e-Mail" with "maria@tse.gov.br" + And I should see "Brazil" within "#profile_data_country" + And I fill in "e-Mail" with "maria@tse.com.br" + And I select "Barbados" from "profile_data[country]" + Then I should see "Barbados" within "#profile_data_country" diff --git a/public/mpog-user-validations.js b/public/mpog-user-validations.js index 33263cb..c055382 100644 --- a/public/mpog-user-validations.js +++ b/public/mpog-user-validations.js @@ -19,14 +19,19 @@ function put_brazil_based_on_email(){ var suffixes = ['gov.br', 'jus.br', 'leg.br', 'mp.br']; var value = this.value; var input_object = this; + var gov_suffix = false; suffixes.each(function(suffix){ var has_suffix = new RegExp("(.*)"+suffix+"$", "i"); - if( has_suffix.test(value) ) + if( has_suffix.test(value) ) { + gov_suffix = true; jQuery("#profile_data_country").val("BR"); + } }); + jQuery("#profile_data_country").prop('disabled', gov_suffix); + check_reactivate_account(value, input_object) } @@ -48,6 +53,8 @@ jQuery(document).ready(function(){ validate_email_format ); + jQuery('#profile_data_country').val("BR"); + jQuery("#user_email").blur( put_brazil_based_on_email ); -- libgit2 0.21.2