From 2981e337140f67c1d555741fa5f9f663c651f26f Mon Sep 17 00:00:00 2001 From: Giovane Date: Mon, 26 Oct 2015 17:01:18 -0200 Subject: Add incomplete email domain verification on compose box. --- .../mail_view/ui/recipients/recipients_input.spec.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'web-ui/test/spec/mail_view/ui') 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 29194ee8..c0b3d22f 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 @@ -34,7 +34,7 @@ describeComponent('mail_view/ui/recipients/recipients_input',function () { expect(addressEnteredEvent).not.toHaveBeenTriggeredOnAndWith(this, { name: 'to', address: '' }); }); - it('wont add address if shift key is pressed together: ' + keycode[1], function () { + it('won`t add address if shift key is pressed together: ' + keycode[1], function () { var addressEnteredEvent = spyOnEvent(this.$node, Pixelated.events.ui.recipients.entered); var enterAddressKeyPressEvent = $.Event('keydown', { which: keycode[0], shiftKey: true }); @@ -186,5 +186,22 @@ describeComponent('mail_view/ui/recipients/recipients_input',function () { expect(addressEnteredEvent.calls[0].data).toEqual({name: 'to', address: 'email@example.com'}); }); + it('displays it as an invalid address token when domain isn`t complete', function() { + this.$node.val('email@example'); + this.$node.trigger(blurEvent); + + expect(blurEvent.preventDefault).toHaveBeenCalled(); + expect(invalidAddressEnteredEvent.calls[0].data).toEqual({name: 'to', address: 'email@example'}); + }); + + it('displays it as an invalid address token when cannonical email domain isn`t complete', function() { + this.$node.val('Invalid '); + this.$node.trigger(blurEvent); + + expect(blurEvent.preventDefault).toHaveBeenCalled(); + expect(invalidAddressEnteredEvent.calls[0].data).toEqual({name: 'to', address: 'Invalid '}); + }); + + }); }); -- cgit v1.2.3