From c8e25d72118c6299424e4483f96707182ced9e27 Mon Sep 17 00:00:00 2001 From: Jefferson Stachelski Date: Fri, 13 Nov 2015 19:12:02 -0200 Subject: Issue #525 - Fixed broken tests --- web-ui/app/js/mixins/with_mail_edit_base.js | 6 +++--- web-ui/test/spec/mail_view/ui/compose_box.spec.js | 6 ++++++ web-ui/test/spec/mixins/with_mail_edit_base.spec.js | 6 ++++++ 3 files changed, 15 insertions(+), 3 deletions(-) (limited to 'web-ui') diff --git a/web-ui/app/js/mixins/with_mail_edit_base.js b/web-ui/app/js/mixins/with_mail_edit_base.js index c9c60c2d..17753cf3 100644 --- a/web-ui/app/js/mixins/with_mail_edit_base.js +++ b/web-ui/app/js/mixins/with_mail_edit_base.js @@ -133,11 +133,11 @@ define( this.sendMail = function () { this.cancelPostponedSaveDraft(); var mail = this.buildMail('sent'); - mail.header.to = this.trim_recipient(mail.header.to); - mail.header.cc = this.trim_recipient(mail.header.cc); - mail.header.bcc = this.trim_recipient(mail.header.bcc); if (allRecipientsAreEmails(mail)) { + mail.header.to = this.trim_recipient(mail.header.to); + mail.header.cc = this.trim_recipient(mail.header.cc); + mail.header.bcc = this.trim_recipient(mail.header.bcc); this.trigger(events.mail.send, mail); } else { this.trigger( diff --git a/web-ui/test/spec/mail_view/ui/compose_box.spec.js b/web-ui/test/spec/mail_view/ui/compose_box.spec.js index 4e43a2ff..84f1e0ed 100644 --- a/web-ui/test/spec/mail_view/ui/compose_box.spec.js +++ b/web-ui/test/spec/mail_view/ui/compose_box.spec.js @@ -3,6 +3,12 @@ describeComponent('mail_view/ui/compose_box', function () { beforeEach(function () { Pixelated.mockBloodhound(); this.setupComponent('
'); + + spyOn(this.component, 'trim_recipient').and.callFake(function(recipients) { + return recipients.map(function(recipient) { + return recipient.trim(); + }); + }); }); diff --git a/web-ui/test/spec/mixins/with_mail_edit_base.spec.js b/web-ui/test/spec/mixins/with_mail_edit_base.spec.js index 940b4b5e..601f2c11 100644 --- a/web-ui/test/spec/mixins/with_mail_edit_base.spec.js +++ b/web-ui/test/spec/mixins/with_mail_edit_base.spec.js @@ -7,6 +7,12 @@ describeMixin('mixins/with_mail_edit_base', function () { this.component.buildMail = function (tag) { return { header: { to: ['a@smth.com'], from: 'b@smth.com', subject: 'Sbject' } }; }; + + spyOn(this.component, 'trim_recipient').and.callFake(function(recipients) { + return recipients.map(function(recipient) { + return recipient.trim(); + }); + }); }); describe('initialization', function() { -- cgit v1.2.3