From db9626029976585edfddfa22243762016ddff221 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Tue, 18 Nov 2014 20:09:13 -0300 Subject: for #14, space does not finish address input anymore --- .../mail_view/ui/recipients/recipients_input.spec.js | 16 +++++++++++++++- 1 file changed, 15 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 6b486fa9..51001e5e 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 @@ -10,7 +10,6 @@ describeComponent('mail_view/ui/recipients/recipients_input',function () { _.each([ [186, 'semicolon'], [188, 'comma'], - [32, 'space'] ], function (keycode) { @@ -77,6 +76,21 @@ describeComponent('mail_view/ui/recipients/recipients_input',function () { expect(addressEnteredEvent).not.toHaveBeenTriggeredOnAndWith(this, { name: 'to', address: ''}); }); }); + + describe('when space is pressed', function () { + it('address input should not finish', function () { + var addressEnteredEvent = spyOnEvent(this.$node, Pixelated.events.ui.recipients.entered); + + var spaceKeyPressEvent = $.Event('keydown', { which: 32}); + spyOn(spaceKeyPressEvent, 'preventDefault'); + + 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' }); + }); + }); }); describe('on keyup', function () { -- cgit v1.2.3