summaryrefslogtreecommitdiff
path: root/web-ui/test/spec/mail_view/ui/recipients/recipients.spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'web-ui/test/spec/mail_view/ui/recipients/recipients.spec.js')
-rw-r--r--web-ui/test/spec/mail_view/ui/recipients/recipients.spec.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/web-ui/test/spec/mail_view/ui/recipients/recipients.spec.js b/web-ui/test/spec/mail_view/ui/recipients/recipients.spec.js
new file mode 100644
index 00000000..692bf0eb
--- /dev/null
+++ b/web-ui/test/spec/mail_view/ui/recipients/recipients.spec.js
@@ -0,0 +1,36 @@
+/* global Smail */
+
+describeComponent('mail_view/ui/recipients/recipients',function () {
+ 'use strict';
+ var recipientsUpdatedEvent;
+
+ describe('initialization', function() {
+ it('adds recipients', function() {
+ setupComponent({name: 'to', addresses: ['foobar@gmail.com'] });
+ expect(this.component.attr.recipients.length).toBe(1);
+ });
+
+ it('does not trigger recipients updated events on initialization', function() {
+ recipientsUpdatedEvent = spyOnEvent(document, Smail.events.ui.recipients.updated);
+
+ setupComponent({name: 'to', addresses: ['foobar@gmail.com'] });
+ expect(recipientsUpdatedEvent).not.toHaveBeenTriggeredOn(document);
+ });
+ });
+
+ describe('adding recipients from the ui', function() {
+ beforeEach(function () {
+ setupComponent();
+ recipientsUpdatedEvent = spyOnEvent(document, Smail.events.ui.recipients.updated);
+ this.component.trigger(Smail.events.ui.recipients.entered, {name: 'to', addresses: ['foobar@gmail.com'] });
+ });
+
+ it('triggers recipients updated', function() {
+ expect(recipientsUpdatedEvent).toHaveBeenTriggeredOn(document);
+ });
+
+ it('adds recipients', function() {
+ expect(this.component.attr.recipients.length).toBe(1);
+ });
+ });
+});