using status messages instead of popup and updated specs for publisher view.
This commit is contained in:
parent
3671f09b1d
commit
ff07bddd1b
2 changed files with 27 additions and 6 deletions
|
|
@ -71,7 +71,7 @@ app.views.PublisherUploader = Backbone.View.extend({
|
|||
} else {
|
||||
this._cancelPhotoUpload();
|
||||
this.trigger('change');
|
||||
alert(Diaspora.I18n.t('photo_uploader.error', {file: fileName}));
|
||||
this.el_info.text(Diaspora.I18n.t('photo_uploader.error', {file: fileName}));
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -382,15 +382,17 @@ describe("app.views.Publisher", function() {
|
|||
});
|
||||
});
|
||||
|
||||
context('completion', function() {
|
||||
context('successful completion', function() {
|
||||
beforeEach(function() {
|
||||
Diaspora.I18n.loadLocale({ photo_uploader: { completed: '<%= file %> completed' }});
|
||||
$('#photodropzone').html('<li class="publisher_photo loading"><img src="" /></li>');
|
||||
|
||||
this.uploader.onComplete(null, 'test.jpg', { data: { photo: {
|
||||
id: '987',
|
||||
unprocessed_image: { url: 'test.jpg' }
|
||||
}}});
|
||||
this.uploader.onComplete(null, 'test.jpg', {
|
||||
data: { photo: {
|
||||
id: '987',
|
||||
unprocessed_image: { url: 'test.jpg' }
|
||||
}},
|
||||
success: true });
|
||||
});
|
||||
|
||||
it('shows it in text form', function() {
|
||||
|
|
@ -417,6 +419,25 @@ describe("app.views.Publisher", function() {
|
|||
expect(this.view.el_preview.prop('disabled')).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
||||
context('unsuccessful completion', function() {
|
||||
beforeEach(function() {
|
||||
Diaspora.I18n.loadLocale({ photo_uploader: { completed: '<%= file %> completed' }});
|
||||
$('#photodropzone').html('<li class="publisher_photo loading"><img src="" /></li>');
|
||||
|
||||
this.uploader.onComplete(null, 'test.jpg', {
|
||||
data: { photo: {
|
||||
id: '987',
|
||||
unprocessed_image: { url: 'test.jpg' }
|
||||
}},
|
||||
success: false });
|
||||
});
|
||||
|
||||
it('shows error message', function() {
|
||||
var info = this.view.view_uploader.el_info;
|
||||
expect(info.text()).toBe(Diaspora.I18n.t('photo_uploader.error', {file: 'test.jpg'}))
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
context('photo removal', function() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue