summaryrefslogtreecommitdiff
path: root/web-ui/test/spec/mail_view/ui
diff options
context:
space:
mode:
authorGiovane <giovaneliberato@gmail.com>2015-10-21 17:14:39 -0200
committerGiovane <giovaneliberato@gmail.com>2015-10-22 14:18:54 -0200
commit6d49949a73cf4757b4f616ee9398863d8ba62988 (patch)
treeaec7aeaf13bf45a8c3e0ee2a7aff4e4e85642457 /web-ui/test/spec/mail_view/ui
parentfc88b2d61d3bf1a09c400cc1e3e3170036377b1a (diff)
Make recipients_input more intelligent and enable tokenize on space #492
- Address can now be just email ou canonical emails(User <user@example.com>) - Trigger tokenize addresses emails when type space
Diffstat (limited to 'web-ui/test/spec/mail_view/ui')
-rw-r--r--web-ui/test/spec/mail_view/ui/recipients/recipients_input.spec.js24
1 files changed, 21 insertions, 3 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 24d57953..90acf85f 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
@@ -89,7 +89,7 @@ describeComponent('mail_view/ui/recipients/recipients_input',function () {
});
describe('when space is pressed', function () {
- it('address input should not finish', function () {
+ it('should tokenize email address', function () {
var addressEnteredEvent = spyOnEvent(this.$node, Pixelated.events.ui.recipients.entered);
var spaceKeyPressEvent = $.Event('keydown', { which: 32});
@@ -98,8 +98,8 @@ describeComponent('mail_view/ui/recipients/recipients_input',function () {
this.$node.val('a@b.c');
this.$node.trigger(spaceKeyPressEvent);
- expect(spaceKeyPressEvent.preventDefault).not.toHaveBeenCalled();
- expect(addressEnteredEvent).not.toHaveBeenTriggeredOnAndWith(this, { name: 'to', address: 'a@b.c' });
+ expect(spaceKeyPressEvent.preventDefault).toHaveBeenCalled();
+ expect(addressEnteredEvent).toHaveBeenTriggeredOnAndWith(this, { name: 'to', address: 'a@b.c' });
});
});
});
@@ -140,5 +140,23 @@ describeComponent('mail_view/ui/recipients/recipients_input',function () {
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'});
});
+
+ it('tokenizes and sanitize adresses separated by space, comma and semicolon', function() {
+ var addressEnteredEvent = spyOnEvent(this.$node, Pixelated.events.ui.recipients.entered);
+ var blurEvent = $.Event('blur');
+ spyOn(blurEvent, 'preventDefault');
+
+ this.$node.val('a@b.c Friend <friend@domain.com>, d@e.f; g@h.i');
+ this.$node.trigger(blurEvent);
+
+ expect(blurEvent.preventDefault).toHaveBeenCalled();
+ expect(addressEnteredEvent.callCount).toEqual(4);
+
+ 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'});
+ expect(addressEnteredEvent.calls[3].data).toEqual({name: 'to', address: 'g@h.i'});
+ });
+
});
});