summaryrefslogtreecommitdiff
path: root/web-ui
diff options
context:
space:
mode:
authorGiovane <giovaneliberato@gmail.com>2015-10-22 15:56:18 -0200
committerGiovane <giovaneliberato@gmail.com>2015-10-23 12:20:03 -0200
commit9bc9f6a2ecf6fbb8092a99fa9d6abbfabc0cc800 (patch)
tree4e27ed7f7ac11e0586d75e8583fb895ac5407f29 /web-ui
parentf81e15f0925bcd5254736b16a490360beacc4a96 (diff)
Extract js code duplication to beforeEach method.
Diffstat (limited to 'web-ui')
-rw-r--r--web-ui/test/spec/mail_view/ui/recipients/recipients_input.spec.js15
1 files changed, 7 insertions, 8 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 90acf85f..6b05d1b6 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
@@ -125,11 +125,15 @@ describeComponent('mail_view/ui/recipients/recipients_input',function () {
});
describe('on blur', function() {
- it('tokenizes and sanitize recipient email if there is an input val', function() {
- var addressEnteredEvent = spyOnEvent(this.$node, Pixelated.events.ui.recipients.entered);
- var blurEvent = $.Event('blur');
+ var addressEnteredEvent, blurEvent;
+
+ beforeEach(function() {
+ addressEnteredEvent = spyOnEvent(this.$node, Pixelated.events.ui.recipients.entered);
+ blurEvent = $.Event('blur');
spyOn(blurEvent, 'preventDefault');
+ });
+ it('tokenizes and sanitize recipient email if there is an input val', function() {
this.$node.val('a@b.c, Friend <friend@domain.com>; d@e.f , , , , , , , ,');
this.$node.trigger(blurEvent);
@@ -142,10 +146,6 @@ describeComponent('mail_view/ui/recipients/recipients_input',function () {
});
it('tokenizes and sanitize adresses separated by space, comma and semicolon', function() {
- var addressEnteredEvent = spyOnEvent(this.$node, Pixelated.events.ui.recipients.entered);
- var blurEvent = $.Event('blur');
- spyOn(blurEvent, 'preventDefault');
-
this.$node.val('a@b.c Friend <friend@domain.com>, d@e.f; g@h.i');
this.$node.trigger(blurEvent);
@@ -157,6 +157,5 @@ describeComponent('mail_view/ui/recipients/recipients_input',function () {
expect(addressEnteredEvent.calls[2].data).toEqual({name: 'to', address: 'd@e.f'});
expect(addressEnteredEvent.calls[3].data).toEqual({name: 'to', address: 'g@h.i'});
});
-
});
});