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 --- .../app/js/mail_view/ui/recipients/recipients_input.js | 1 - .../mail_view/ui/recipients/recipients_input.spec.js | 16 +++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/web-ui/app/js/mail_view/ui/recipients/recipients_input.js b/web-ui/app/js/mail_view/ui/recipients/recipients_input.js index e9211d85..b65e6080 100644 --- a/web-ui/app/js/mail_view/ui/recipients/recipients_input.js +++ b/web-ui/app/js/mail_view/ui/recipients/recipients_input.js @@ -34,7 +34,6 @@ define([ 9: 'tab', 186: 'semicolon', 188: 'comma', - 32: 'space', 13: 'enter', 27: 'esc' }, 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