mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-04 10:54:30 +08:00
Fix tests
This commit is contained in:
parent
521a367960
commit
54627faeb3
5 changed files with 6 additions and 14 deletions
|
@ -89,7 +89,7 @@ var avatarsModal = (function() {
|
|||
initCropTool();
|
||||
initPredefinedAvatars();
|
||||
initUpdateButton();
|
||||
$('.user-settings-edit-avatar').click(() => {
|
||||
$('.user-settings-edit-avatar img, .user-settings-edit-avatar').click(() => {
|
||||
$(modal).modal('show');
|
||||
});
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ class Users::RegistrationsController < Devise::RegistrationsController
|
|||
yield resource if block_given?
|
||||
if resource_updated
|
||||
# Set "needs confirmation" flash if neccesary
|
||||
if is_flashing_format?
|
||||
if is_flashing_format? || account_update_params['change_avatar']
|
||||
flash_key = update_needs_confirmation?(resource, prev_unconfirmed_email) ?
|
||||
:update_needs_confirmation : :updated
|
||||
set_flash_message :notice, flash_key
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<div class="btn btn-primary save-button disabled"><%= t('general.save') %></div>
|
||||
<button type="button" class="btn btn-primary save-button disabled"><%= t('general.save') %></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -18,20 +18,12 @@ Background:
|
|||
And I click "Settings" link within "#user-account-dropdown"
|
||||
Then I should see "My profile"
|
||||
|
||||
@javascript
|
||||
Scenario: Unsuccessful avatar image upload, file is too big
|
||||
Given I'm on the profile page
|
||||
Then I click on image within ".avatar-container" element
|
||||
And I attach a "Moon.png" file to "#user_raw_avatar" field
|
||||
And I trigger click '#user-avatar-field .btn-success'
|
||||
And I should see "Your avatar file cannot be larger than 0.2 MB. (Please try again with a smaller file.)" error message
|
||||
|
||||
@javascript
|
||||
Scenario: Successful upload avatar image
|
||||
Given I'm on the profile page
|
||||
Then I click on image within ".avatar-container" element
|
||||
And I attach a "Star.png" file to "#user_raw_avatar" field
|
||||
Then I click "Upload" button
|
||||
And I attach a "Star.png" file to "#raw_avatar" field
|
||||
Then I click "Save" button
|
||||
And I should see "Your account has been updated successfully" flash message
|
||||
|
||||
@javascript
|
||||
|
|
|
@ -69,7 +69,7 @@ end
|
|||
|
||||
Then(/^I attach a "([^"]*)" file to "([^"]*)" field$/) do |file, field_id|
|
||||
wait_for_ajax
|
||||
find(field_id).attach_file(Rails.root.join('features', 'assets', file))
|
||||
find(field_id, :visible => false).attach_file(Rails.root.join('features', 'assets', file))
|
||||
# "expensive" operation needs some time :=)
|
||||
sleep(0.5)
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue