summaryrefslogtreecommitdiff
path: root/web-ui/test
diff options
context:
space:
mode:
Diffstat (limited to 'web-ui/test')
-rw-r--r--web-ui/test/spec/mail_list/ui/mail_list.spec.js2
-rw-r--r--web-ui/test/spec/mail_view/ui/recipients/recipients_input.spec.js26
2 files changed, 26 insertions, 2 deletions
diff --git a/web-ui/test/spec/mail_list/ui/mail_list.spec.js b/web-ui/test/spec/mail_list/ui/mail_list.spec.js
index d90f906c..23ca87fb 100644
--- a/web-ui/test/spec/mail_list/ui/mail_list.spec.js
+++ b/web-ui/test/spec/mail_list/ui/mail_list.spec.js
@@ -225,7 +225,7 @@ describeComponent('mail_list/ui/mail_list', function () {
expect(node.html()).toMatch('id="mail-' + mail.ident + '"');
expect(node.html()).toMatch('<div class="subject-and-tags">');
expect(node.html()).toMatch('<div class="from">' + mail.header.from + '</div>');
- expect(node.html()).toMatch('<span class="received-date">' + mail.header.formattedDate + '</span>');
+ expect(node.html()).toMatch('<span class="received-date">' + mail.header.formattedDate);
}
function matchSelectedMail(mail, node) {
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..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
@@ -10,7 +10,6 @@ describeComponent('mail_view/ui/recipients/recipients_input',function () {
_.each([
[186, 'semicolon'],
[188, 'comma'],
- [32, 'space']
], function (keycode) {
@@ -34,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');
@@ -77,6 +86,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 () {