summaryrefslogtreecommitdiff
path: root/web-ui/test/spec/mixins
diff options
context:
space:
mode:
authorDuda Dornelles <ddornell@thoughtworks.com>2014-10-09 10:49:08 +0200
committerDuda Dornelles <ddornell@thoughtworks.com>2014-10-09 10:51:18 +0200
commit21b025f80e8fc4168a9717cf691114a0b5154baf (patch)
treedbf6ec4a3747f2e4291c7c3afc353128bc4aafe8 /web-ui/test/spec/mixins
parentba8024b667a4ca16305e3b8c6fe566ba328a488d (diff)
Fixing bug where the send button would get disabled at times even if there were valid receipients
Diffstat (limited to 'web-ui/test/spec/mixins')
-rw-r--r--web-ui/test/spec/mixins/with_mail_edit_base.spec.js27
1 files changed, 6 insertions, 21 deletions
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 10b7d04c..f62c1f75 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
@@ -15,33 +15,18 @@ describeMixin('mixins/with_mail_edit_base', function () {
});
describe('initialization', function() {
- it('should enable send button when rendering with recipients', function() {
- var enableSendButtonEvent = spyOnEvent(document, Pixelated.events.ui.sendbutton.enable);
- this.component.render(function() {}, {
- recipients: { to: ['foobar@mail.com'], cc: [] }
- });
- expect(enableSendButtonEvent).toHaveBeenTriggeredOn(document);
- enableSendButtonEvent = spyOnEvent(document, Pixelated.events.ui.sendbutton.enable);
- this.component.render(function() {}, {
- recipients: { to: ['foobar@mail.com'], cc: undefined }
- });
- expect(enableSendButtonEvent).toHaveBeenTriggeredOn(document);
- });
+ it('should warn send button of existing recipients', function () {
+ var recipientsUpdatedEvent = spyOnEvent(document, Pixelated.events.ui.recipients.updated);
- it('should not enable send button when rendering without recipients', function() {
- var enableSendButtonEvent = spyOnEvent(document, Pixelated.events.ui.sendbutton.enable);
this.component.render(function() {}, {
- recipients: { to: [], cc: [] }
+ recipients: { to: ['foobar@mail.com'], cc: [] }
});
- expect(enableSendButtonEvent).not.toHaveBeenTriggeredOn(document);
- enableSendButtonEvent = spyOnEvent(document, Pixelated.events.ui.sendbutton.enable);
- this.component.render(function() {}, {
- recipients: { to: undefined, cc: undefined }
- });
- expect(enableSendButtonEvent).not.toHaveBeenTriggeredOn(document);
+ expect(recipientsUpdatedEvent).toHaveBeenTriggeredOnAndWith(document, { newRecipients: ['foobar@mail.com'], name: 'to'});
+ expect(recipientsUpdatedEvent).not.toHaveBeenTriggeredOnAndWith(document, { newRecipients: [], name: 'cc'});
});
+
});
describe('when the user is typing in subject or body', function() {