summaryrefslogtreecommitdiff
path: root/web-ui
diff options
context:
space:
mode:
Diffstat (limited to 'web-ui')
-rw-r--r--web-ui/app/js/mail_view/data/mail_sender.js10
-rw-r--r--web-ui/test/spec/mail_view/ui/send_button.spec.js12
2 files changed, 20 insertions, 2 deletions
diff --git a/web-ui/app/js/mail_view/data/mail_sender.js b/web-ui/app/js/mail_view/data/mail_sender.js
index 4c7e07ea..d7247601 100644
--- a/web-ui/app/js/mail_view/data/mail_sender.js
+++ b/web-ui/app/js/mail_view/data/mail_sender.js
@@ -28,12 +28,18 @@ define(
return defineComponent(mailSender);
function mailSender() {
- function successSendMail(on){
+ function successSendingMail(on){
return function(result) {
on.trigger(document, events.mail.sent, result);
};
}
+ function failureSendingMail(on) {
+ return function(result) {
+ on.trigger(document, events.mail.send_failed);
+ }
+ };
+
function successSaveDraft(on){
return function(result){
on.trigger(document, events.mail.draftSaved, result);
@@ -50,7 +56,7 @@ define(
dataType: 'json',
contentType: 'application/json; charset=utf-8',
data: JSON.stringify(data),
- }).done(successSendMail(this));
+ }).done(successSendingMail(this)).fail(failureSendingMail(this));
};
diff --git a/web-ui/test/spec/mail_view/ui/send_button.spec.js b/web-ui/test/spec/mail_view/ui/send_button.spec.js
index ff1eecde..dc9b940d 100644
--- a/web-ui/test/spec/mail_view/ui/send_button.spec.js
+++ b/web-ui/test/spec/mail_view/ui/send_button.spec.js
@@ -91,6 +91,18 @@ describeComponent('mail_view/ui/send_button', function () {
expect(this.$node.text()).toBe('Sending...');
expect(this.$node.prop('disabled')).toBeTruthy();
});
+
+ it('enables again if sending errors out', function() {
+ expect(this.$node.text()).toBe('Send');
+
+ this.$node.click();
+
+ $(document).trigger(Pixelated.events.mail.send_failed);
+
+ expect(this.$node.text()).toBe('Send');
+ expect(this.$node.prop('disabled')).not.toBeTruthy();
+
+ })
});
describe('after clicking', function () {