diff options
Diffstat (limited to 'web-ui/test')
-rw-r--r-- | web-ui/test/spec/mail_view/ui/recipients/recipients_input.spec.js | 19 |
1 files changed, 18 insertions, 1 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 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 <email@example>'); + this.$node.trigger(blurEvent); + + expect(blurEvent.preventDefault).toHaveBeenCalled(); + expect(invalidAddressEnteredEvent.calls[0].data).toEqual({name: 'to', address: 'Invalid <email@example>'}); + }); + + }); }); |