mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-01 05:02:50 +08:00
Merge pull request #993 from ZmagoD/zd_SCI_2039
fixes errors with form id duplicates [fixes SCI-2039]
This commit is contained in:
commit
0583979cf9
3 changed files with 24 additions and 23 deletions
|
@ -18,8 +18,10 @@
|
|||
<%= devise_error_messages! %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put, "data-for" => "avatar" }) do |f| %>
|
||||
<%= form_for(resource,
|
||||
as: resource_name,
|
||||
url: registration_path(resource_name),
|
||||
html: { method: :put, "data-for" => "avatar", id: 'user-avatar-field' }) do |f| %>
|
||||
<%= hidden_field_tag "user[change_avatar]", "true" %>
|
||||
<div data-part="view">
|
||||
<div class="form-group">
|
||||
|
@ -54,12 +56,11 @@
|
|||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= form_for(resource,
|
||||
as: resource_name,
|
||||
url: registration_path(resource_name, format: :json),
|
||||
remote: true,
|
||||
html: { method: :put, "data-for" => "full_name", class: 'settings-page-full-name' }) do |f| %>
|
||||
html: { method: :put, "data-for" => "full_name", class: 'settings-page-full-name', id: 'user-full_name-field' }) do |f| %>
|
||||
<div data-part="view">
|
||||
<div class="form-group">
|
||||
<%= f.label t("users.registrations.edit.name_label") %>
|
||||
|
@ -90,7 +91,7 @@
|
|||
as: resource_name,
|
||||
url: registration_path(resource_name, format: :json),
|
||||
remote: true,
|
||||
html: { method: :put, "data-for" => "initials", class: 'settings-page-initials' }) do |f| %>
|
||||
html: { method: :put, "data-for" => "initials", class: 'settings-page-initials', id: 'user-initials-field' }) do |f| %>
|
||||
<div data-part="view">
|
||||
<div class="form-group">
|
||||
<%= f.label t("users.registrations.edit.initials_label") %>
|
||||
|
@ -121,7 +122,7 @@
|
|||
as: resource_name,
|
||||
url: registration_path(resource_name, format: :json),
|
||||
remote: true,
|
||||
html: { method: :put, "data-for" => "email", class: 'settings-page-email' }) do |f| %>
|
||||
html: { method: :put, "data-for" => "email", class: 'settings-page-email', id: 'user-email-field' }) do |f| %>
|
||||
<div data-part="view">
|
||||
<div class="form-group">
|
||||
<%= f.label t("users.registrations.edit.email_label") %>
|
||||
|
@ -148,7 +149,7 @@
|
|||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.label :current_password, t("users.registrations.edit.current_password_label") %> <i><%=t "users.registrations.edit.password_explanation" %></i>
|
||||
<%= f.password_field :current_password, autocomplete: "off", class: "form-control", "data-role" => "clear" %>
|
||||
<%= f.password_field :current_password, autocomplete: "off", class: "form-control", "data-role" => "clear", id: 'edit-email-current-password' %>
|
||||
</div>
|
||||
<div>
|
||||
<a href="#" class="btn btn-default" data-action="cancel"><%=t "general.cancel" %></a>
|
||||
|
@ -162,7 +163,7 @@
|
|||
as: resource_name,
|
||||
url: registration_path(resource_name, format: :json),
|
||||
remote: true,
|
||||
html: { method: :put, "data-for" => "password", class: 'settings-page-change-password' }) do |f| %>
|
||||
html: { method: :put, "data-for" => "password", class: 'settings-page-change-password', id: 'user-password-field' }) do |f| %>
|
||||
<%= hidden_field_tag "user[change_password]", "true" %>
|
||||
<div data-part="view">
|
||||
<div class="form-group">
|
||||
|
@ -180,7 +181,7 @@
|
|||
<h4><%=t "users.registrations.edit.password_title" %></h4>
|
||||
<div class="form-group">
|
||||
<%= f.label :current_password, t("users.registrations.edit.current_password_label") %> <i><%=t "users.registrations.edit.password_explanation" %></i>
|
||||
<%= f.password_field :current_password, autocomplete: "off", class: "form-control", "data-role" => "clear" %>
|
||||
<%= f.password_field :current_password, autocomplete: "off", class: "form-control", "data-role" => "clear", id: 'edit-password-current-password' %>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
|
|
@ -71,7 +71,7 @@ Scenario: Successfully changes user email
|
|||
Given I'm on the profile page
|
||||
Then I click on Edit on ".settings-page-email" input field
|
||||
And I change "nonadmin@myorg.com" with "user@myorg.com" email
|
||||
And I fill in "mypassword1234" in "Current password" field of ".settings-page-email" form
|
||||
And I fill in "mypassword1234" in "#edit-email-current-password" field of ".settings-page-email" form
|
||||
Then I click "Update" button
|
||||
And I should see "user@myorg.com" in ".settings-page-email" input field
|
||||
|
||||
|
@ -79,9 +79,9 @@ Scenario: Successfully changes user email
|
|||
Scenario: Unsuccessful Password Change, password is too short
|
||||
Given I'm on the profile page
|
||||
Then I click on Edit on ".settings-page-change-password" input field
|
||||
And I fill in "mypassword1234" in "Current password" field of ".settings-page-change-password" form
|
||||
And I fill in "mypass" in "New password" field of ".settings-page-change-password" form
|
||||
And I fill in "mypass" in "New password confirmation" field of ".settings-page-change-password" form
|
||||
And I fill in "mypassword1234" in "#edit-password-current-password" field of ".settings-page-change-password" form
|
||||
And I fill in "mypass" in "#user_password" field of ".settings-page-change-password" form
|
||||
And I fill in "mypass" in "#user_password_confirmation" field of ".settings-page-change-password" form
|
||||
Then I click "Update" button
|
||||
And I should see "is too short (minimum is 8 characters)"
|
||||
|
||||
|
@ -89,9 +89,9 @@ Scenario: Unsuccessful Password Change, password is too short
|
|||
Scenario: Unsuccessful Password Change, passwords does not match
|
||||
Given I'm on the profile page
|
||||
Then I click on Edit on ".settings-page-change-password" input field
|
||||
And I fill in "mypassword1234" in "Current password" field of ".settings-page-change-password" form
|
||||
And I fill in "mypassword5678" in "New password" field of ".settings-page-change-password" form
|
||||
And I fill in "mypassword56788" in "New password confirmation" field of ".settings-page-change-password" form
|
||||
And I fill in "mypassword1234" in "#edit-password-current-password" field of ".settings-page-change-password" form
|
||||
And I fill in "mypassword5678" in "#user_password" field of ".settings-page-change-password" form
|
||||
And I fill in "mypassword56788" in "#user_password_confirmation" field of ".settings-page-change-password" form
|
||||
Then I click "Update" button
|
||||
And I should see "doesn't match"
|
||||
|
||||
|
@ -99,9 +99,9 @@ Scenario: Unsuccessful Password Change, passwords does not match
|
|||
Scenario: Unsuccessful Password Change, current password is invalid
|
||||
Given I'm on the profile page
|
||||
Then I click on Edit on ".settings-page-change-password" input field
|
||||
And I fill in "mypassword123" in "Current password" field of ".settings-page-change-password" form
|
||||
And I fill in "mypassword5678" in "New password" field of ".settings-page-change-password" form
|
||||
And I fill in "mypassword5678" in "New password confirmation" field of ".settings-page-change-password" form
|
||||
And I fill in "mypassword123" in "#edit-password-current-password" field of ".settings-page-change-password" form
|
||||
And I fill in "mypassword5678" in "#user_password" field of ".settings-page-change-password" form
|
||||
And I fill in "mypassword5678" in "#user_password_confirmation" field of ".settings-page-change-password" form
|
||||
Then I click "Update" button
|
||||
And I should see "is invalid"
|
||||
|
||||
|
@ -109,8 +109,8 @@ Scenario: Unsuccessful Password Change, current password is invalid
|
|||
Scenario: Successful Password Change
|
||||
Given I'm on the profile page
|
||||
Then I click on Edit on ".settings-page-change-password" input field
|
||||
And I fill in "mypassword1234" in "Current password" field of ".settings-page-change-password" form
|
||||
And I fill in "mypassword5678" in "New password" field of ".settings-page-change-password" form
|
||||
And I fill in "mypassword5678" in "New password confirmation" field of ".settings-page-change-password" form
|
||||
And I fill in "mypassword1234" in "#edit-password-current-password" field of ".settings-page-change-password" form
|
||||
And I fill in "mypassword5678" in "#user_password" field of ".settings-page-change-password" form
|
||||
And I fill in "mypassword5678" in "#user_password_confirmation" field of ".settings-page-change-password" form
|
||||
Then I click "Update" button
|
||||
And I should see "Password successfully updated." flash message
|
||||
|
|
|
@ -17,6 +17,6 @@ end
|
|||
|
||||
Then(/^I fill in "([^"]*)" in "([^"]*)" field of "([^"]*)" form$/) do |password, field, form_id|
|
||||
within form_id do
|
||||
fill_in field, with: password
|
||||
find(field).set(password)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue