summaryrefslogtreecommitdiff
path: root/web-ui
diff options
context:
space:
mode:
authorVictor Shyba <victor.shyba@gmail.com>2014-11-18 20:10:40 -0300
committerVictor Shyba <victor.shyba@gmail.com>2014-11-18 20:10:40 -0300
commit8e001a93b7d90bd394c9401c0f1b4acf77e4f9b7 (patch)
tree3a83cec2f67e8b5ba4890286c16f31ba6a8ee2c2 /web-ui
parentdb9626029976585edfddfa22243762016ddff221 (diff)
for #14, if shift is pressed with a finish key it should ignore the event, since the key isnt the expected
Diffstat (limited to 'web-ui')
-rw-r--r--web-ui/app/js/mail_view/ui/recipients/recipients_input.js2
-rw-r--r--web-ui/test/spec/mail_view/ui/recipients/recipients_input.spec.js10
2 files changed, 11 insertions, 1 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 b65e6080..8f647d01 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
@@ -100,7 +100,7 @@ define([
return;
}
- if (isEnterAddressKey(keyPressed)) {
+ if (!event.shiftKey && isEnterAddressKey(keyPressed)) {
this.tokenizeRecipient(event);
if ((keyPressed !== 9 /* tab */)) {
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 51001e5e..433c145b 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
@@ -33,6 +33,16 @@ 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 () {
+ var addressEnteredEvent = spyOnEvent(this.$node, Pixelated.events.ui.recipients.entered);
+
+ var enterAddressKeyPressEvent = $.Event('keydown', { which: keycode[0], shiftKey: true });
+ this.$node.val('a@b.c');
+ this.$node.trigger(enterAddressKeyPressEvent);
+
+ expect(addressEnteredEvent).not.toHaveBeenTriggeredOnAndWith(this, { name: 'to', address: 'a@b.c' });
+ });
+
it('prevents event default regardless on input val when key is ' + keycode[1], function () {
var enterAddressKeyPressEvent = $.Event('keydown', { which: keycode[0] });
spyOn(enterAddressKeyPressEvent, 'preventDefault');