summaryrefslogtreecommitdiff
path: root/web-ui/test
diff options
context:
space:
mode:
authorPatrick Maia and Victor Shyba <pixelated-team+pmaia+vshyba@thoughtworks.com>2014-11-24 18:07:54 -0300
committerPatrick Maia <pmaia@thoughtworks.com>2014-11-24 18:08:24 -0300
commit42229ae94c50c6b6184f47b072c52994cd3083c1 (patch)
treede524d91111c62f5fccd273a857c245b82fe80a7 /web-ui/test
parented857631616052bc137c6b1d50368bfbf711210d (diff)
Card #162 - tokenizes multiple recipients entered at once
Diffstat (limited to 'web-ui/test')
-rw-r--r--web-ui/test/spec/mail_view/ui/recipients/recipients_input.spec.js16
1 files changed, 10 insertions, 6 deletions
diff --git a/web-ui/test/spec/mail_view/ui/recipients/recipients_input.spec.js b/web-ui/test/spec/mail_view/ui/recipients/recipients_input.spec.js
index 433c145b..d4fb8faf 100644
--- a/web-ui/test/spec/mail_view/ui/recipients/recipients_input.spec.js
+++ b/web-ui/test/spec/mail_view/ui/recipients/recipients_input.spec.js
@@ -124,16 +124,20 @@ describeComponent('mail_view/ui/recipients/recipients_input',function () {
});
describe('on blur', function() {
- it('tokenizes recipient email if there is an input val', function() {
+ it('tokenizes and sanitize recipient email if there is an input val', function() {
var addressEnteredEvent = spyOnEvent(this.$node, Pixelated.events.ui.recipients.entered);
var blurEvent = $.Event('blur');
- spyOn(blurEvent, 'preventDefault');
+ spyOn(blurEvent, 'preventDefault');
- this.$node.val('a@b.c');
- this.$node.trigger(blurEvent);
+ this.$node.val('a@b.c, Friend <friend@domain.com>; d@e.f , , , , , , , ,');
+ this.$node.trigger(blurEvent);
- expect(blurEvent.preventDefault).toHaveBeenCalled();
- expect(addressEnteredEvent).toHaveBeenTriggeredOnAndWith(this, {name: 'to', address: 'a@b.c'});
+ expect(blurEvent.preventDefault).toHaveBeenCalled();
+ expect(addressEnteredEvent.callCount).toEqual(3);
+
+ expect(addressEnteredEvent.calls[0].data).toEqual({name: 'to', address: 'a@b.c'});
+ expect(addressEnteredEvent.calls[1].data).toEqual({name: 'to', address: 'Friend <friend@domain.com>'});
+ expect(addressEnteredEvent.calls[2].data).toEqual({name: 'to', address: 'd@e.f'});
})
});
});