* VRFS-783 - the filepicker service behaves different; workaround added. test attempted, but does not work because phantomjs crashes
This commit is contained in:
parent
7a710a64c0
commit
2d28227b9f
|
|
@ -15,6 +15,7 @@
|
|||
var selection = null;
|
||||
var targetCropSize = 88;
|
||||
var updatingAvatar = false;
|
||||
var userDropdown;
|
||||
|
||||
function beforeShow(data) {
|
||||
userId = data.id;
|
||||
|
|
@ -92,7 +93,7 @@
|
|||
function deleteAvatarSuccess(response) {
|
||||
|
||||
renderAvatar(null, null);
|
||||
JK.UserDropdown.loadMe();
|
||||
userDropdown.loadMe();
|
||||
|
||||
rest.getUserDetail()
|
||||
.done(function(userDetail) {
|
||||
|
|
@ -306,8 +307,9 @@
|
|||
quality: 90,
|
||||
policy: filepickerPolicy.policy,
|
||||
signature: filepickerPolicy.signature
|
||||
}, { path: createStorePath(self.userDetail) + 'cropped.jpg', access: 'public' },
|
||||
}, { path: createStorePath(self.userDetail) + 'cropped-' + new Date().getTime() + '.jpg', access: 'public' },
|
||||
function(cropped) {
|
||||
logger.debug("converting cropped");
|
||||
rest.getFilepickerPolicy({handle: cropped.url, convert: true})
|
||||
.done(function(filepickerPolicy) {
|
||||
filepicker.convert(cropped, {
|
||||
|
|
@ -320,6 +322,7 @@
|
|||
signature: filepickerPolicy.signature
|
||||
}, { path: createStorePath(self.userDetail), access: 'public' },
|
||||
function(scaled) {
|
||||
logger.debug("converted and scaled final image %o", scaled);
|
||||
rest.updateAvatar({
|
||||
original_fpfile: determineCurrentFpfile(),
|
||||
cropped_fpfile: scaled,
|
||||
|
|
@ -361,7 +364,7 @@
|
|||
self.userDetail = response;
|
||||
|
||||
// notify any listeners that the avatar changed
|
||||
JK.UserDropdown.loadMe();
|
||||
userDropdown.loadMe();
|
||||
// $('.avatar_large img').trigger('avatar_changed', [self.userDetail.photo_url]);
|
||||
|
||||
app.notify(
|
||||
|
|
@ -414,13 +417,15 @@
|
|||
return $.cookie('original_fpfile') == null ? userDetail.crop_selection : null;
|
||||
}
|
||||
|
||||
function initialize() {
|
||||
function initialize(userDropdownInstance) {
|
||||
var screenBindings = {
|
||||
'beforeShow': beforeShow,
|
||||
'afterShow': afterShow
|
||||
};
|
||||
app.bindScreen('account/profile/avatar', screenBindings);
|
||||
events();
|
||||
|
||||
userDropdown = userDropdownInstance;
|
||||
}
|
||||
|
||||
this.initialize = initialize;
|
||||
|
|
|
|||
|
|
@ -89,5 +89,6 @@
|
|||
invitationDialog = invitationDialogInstance;
|
||||
loadMe();
|
||||
}
|
||||
this.loadMe = loadMe;
|
||||
}
|
||||
})(window,jQuery);
|
||||
|
|
@ -117,7 +117,7 @@
|
|||
accountProfileScreen.initialize();
|
||||
|
||||
var accountProfileAvatarScreen = new JK.AccountProfileAvatarScreen(JK.app);
|
||||
accountProfileAvatarScreen.initialize();
|
||||
accountProfileAvatarScreen.initialize(userDropdown);
|
||||
|
||||
var accountAudioProfile = new JK.AccountAudioProfile(JK.app);
|
||||
accountAudioProfile.initialize();
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 304 B |
|
|
@ -0,0 +1,32 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe "Avatar", :js => true, :type => :feature, :capybara_feature => true do
|
||||
|
||||
subject { page }
|
||||
|
||||
before(:all) do
|
||||
Capybara.javascript_driver = :poltergeist
|
||||
Capybara.current_driver = Capybara.javascript_driver
|
||||
Capybara.default_wait_time = 10
|
||||
end
|
||||
|
||||
let(:user) { FactoryGirl.create(:user) }
|
||||
|
||||
before(:each) do
|
||||
UserMailer.deliveries.clear
|
||||
sign_in_poltergeist user
|
||||
visit "/client#/account/profile/avatar"
|
||||
|
||||
find('#account-edit-avatar-upload')
|
||||
end
|
||||
|
||||
it {
|
||||
pending "capybara crashes trying this test"
|
||||
should have_selector('#account-edit-avatar-upload')
|
||||
click_link "UPLOAD" # launch filepicker dialog, which is an iframe
|
||||
within_frame('filepicker_dialog') {
|
||||
attach_file('fileUpload', 'spec/assets/images/sample_avatar.png')
|
||||
find('div.jcrop-tracker').should_not be_nil
|
||||
}
|
||||
}
|
||||
end
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
/* Selection Border */
|
||||
.jcrop-vline,
|
||||
.jcrop-hline {
|
||||
background: #ffffff url("Jcrop.gif");
|
||||
background: #ffffff url("/assets/Jcrop.gif");
|
||||
font-size: 0;
|
||||
position: absolute;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue