Browse Source

#657: Add test suite for the events option, thanks to @stephengreentree

Phuoc Nguyen 11 years ago
parent
commit
b9c16bb675

+ 1 - 1
CHANGELOG.md

@@ -10,7 +10,7 @@ __New features__
 * [#536](https://github.com/nghuuphuoc/bootstrapvalidator/pull/536): Add Spanish [phone number](http://bootstrapvalidator.com/validators/phone/) validator, thanks to [@vadail](https://github.com/vadail)
 * [#519](https://github.com/nghuuphuoc/bootstrapvalidator/pull/519): Add Iceland [VAT](http://bootstrapvalidator.com/validators/vat/) number validator, thanks to [@evilchili](https://github.com/evilchili)
 * [#621](https://github.com/nghuuphuoc/bootstrapvalidator/pull/621): Add Pakistan [phone number](http://bootstrapvalidator.com/validators/phone/) validator, thanks to [@abuzer](https://github.com/abuzer)
-* [#630](https://github.com/nghuuphuoc/bootstrapvalidator/issues/630), [#640](https://github.com/nghuuphuoc/bootstrapvalidator/pull/640): Add event name options to avoid window.onerror being invoked by jQuery, thanks to [@roryprimrose](https://github.com/roryprimrose)
+* [#630](https://github.com/nghuuphuoc/bootstrapvalidator/issues/630), [#640](https://github.com/nghuuphuoc/bootstrapvalidator/pull/640): Add event name options to avoid window.onerror being invoked by jQuery, thanks to [@roryprimrose](https://github.com/roryprimrose). Thanks to [@stephengreentree](https://github.com/stephengreentree) for creating the test suite ([#657](https://github.com/nghuuphuoc/bootstrapvalidator/pull/657))
 * [#637](https://github.com/nghuuphuoc/bootstrapvalidator/pull/637): Add South African [VAT](http://bootstrapvalidator.com/validators/vat/) number validator, thanks to [@evilchili](https://github.com/evilchili)
 * [#638](https://github.com/nghuuphuoc/bootstrapvalidator/pull/638), [#647](https://github.com/nghuuphuoc/bootstrapvalidator/pull/647): Add Brazilian [phone number](http://bootstrapvalidator.com/validators/phone/) and [postal code](http://bootstrapvalidator.com/validators/zipCode/) validator, thanks to [@fhferreira](https://github.com/fhferreira)
 * [#643](https://github.com/nghuuphuoc/bootstrapvalidator/pull/643): Add [zipCode](http://bootstrapvalidator.com/validators/zipCode/), [iban](http://bootstrapvalidator.com/validators/iban/) and [phone number](http://bootstrapvalidator.com/validators/phone/) validators for Morocco, thanks to [@Arkni](https://github.com/Arkni)

+ 1 - 0
CONTRIBUTORS.md

@@ -56,6 +56,7 @@ I would like to give big thanks to the following contributors:
 * [@roryprimrose](https://github.com/roryprimrose)
 * [@ryan2049](https://github.com/ryan2049)
 * [@smeagol74](https://github.com/smeagol74)
+* [@stephengreentree](https://github.com/stephengreentree)
 * [@thisisclement](https://github.com/thisisclement)
 * [@tiagofontella](https://github.com/tiagofontella)
 * [@tomByrer](https://github.com/tomByrer)

+ 1 - 1
dist/css/bootstrapValidator.min.css

@@ -2,7 +2,7 @@
  * BootstrapValidator (http://bootstrapvalidator.com)
  * The best jQuery plugin to validate form fields. Designed to use with Bootstrap 3
  *
- * @version     v0.5.1-dev, built on 2014-08-14 8:29:24 AM
+ * @version     v0.5.1-dev, built on 2014-08-14 8:41:52 AM
  * @author      https://twitter.com/nghuuphuoc
  * @copyright   (c) 2013 - 2014 Nguyen Huu Phuoc
  * @license     MIT

+ 1 - 1
dist/js/bootstrapValidator.js

@@ -2,7 +2,7 @@
  * BootstrapValidator (http://bootstrapvalidator.com)
  * The best jQuery plugin to validate form fields. Designed to use with Bootstrap 3
  *
- * @version     v0.5.1-dev, built on 2014-08-14 8:29:24 AM
+ * @version     v0.5.1-dev, built on 2014-08-14 8:41:52 AM
  * @author      https://twitter.com/nghuuphuoc
  * @copyright   (c) 2013 - 2014 Nguyen Huu Phuoc
  * @license     MIT

+ 1 - 1
dist/js/bootstrapValidator.min.js

@@ -2,7 +2,7 @@
  * BootstrapValidator (http://bootstrapvalidator.com)
  * The best jQuery plugin to validate form fields. Designed to use with Bootstrap 3
  *
- * @version     v0.5.1-dev, built on 2014-08-14 8:29:24 AM
+ * @version     v0.5.1-dev, built on 2014-08-14 8:41:52 AM
  * @author      https://twitter.com/nghuuphuoc
  * @copyright   (c) 2013 - 2014 Nguyen Huu Phuoc
  * @license     MIT

+ 275 - 0
test/spec.js

@@ -735,8 +735,283 @@ describe('event field programmatically', function() {
 });
 
 // ---
+// Modifying default events
+// ---
+
+describe('event form trigger with default events', function() {
+    beforeEach(function() {
+        $([
+            '<form class="form-horizontal" id="eventForm1">',
+                '<div id="msg"></div>',
+                '<div class="form-group">',
+                    '<input type="text" name="email" data-bv-emailaddress />',
+                '</div>',
+            '</form>'
+        ].join('\n')).appendTo('body');
+
+        $('#eventForm1')
+            .bootstrapValidator()
+            .on('bv.form.success', function(e) {
+                $('#msg').html('form ' + $(e.target).attr('id') + ' triggered bv.form.success event');
+            })
+            .on('success.form.bv', function(e) {
+                $('#msg').html('form ' + $(e.target).attr('id') + ' triggered success.form.bv event');
+            })
+            .on('bv.form.error', function(e) {
+                $('#msg').html('form ' + $(e.target).attr('id') + ' triggered bv.form.error event');
+            })
+            .on('error.form.bv', function(e) {
+                $('#msg').html('form ' + $(e.target).attr('id') + ' triggered error.form.bv event');
+            });
+
+        this.bv     = $('#eventForm1').data('bootstrapValidator');
+        this.$email = this.bv.getFieldElements('email');
+    });
+
+    afterEach(function() {
+        $('#eventForm1').bootstrapValidator('destroy').remove();
+    });
+
+    it('does not trigger bv.form.success', function() {
+        this.$email.val('email@domain.com');
+        this.bv.validate();
+        expect($('#msg').html()).not.toEqual('form eventForm1 triggered bv.form.success event');
+    });
+
+    it('triggers success.form.bv', function() {
+        this.$email.val('email@domain.com');
+        this.bv.validate();
+        expect($('#msg').html()).toEqual('form eventForm1 triggered success.form.bv event');
+    });
+
+    it('does not trigger bv.form.error', function() {
+        this.$email.val('email@domain');
+        this.bv.validate();
+        expect($('#msg').html()).not.toEqual('form eventForm1 triggered bv.form.error event');
+    });
+
+    it('triggers error.form.bv', function() {
+        this.$email.val('email@domain');
+        this.bv.validate();
+        expect($('#msg').html()).toEqual('form eventForm1 triggered error.form.bv event');
+    });
+});
+
+describe('event field trigger with default events', function() {
+    beforeEach(function() {
+        $([
+            '<form class="form-horizontal" id="eventForm3">',
+                '<div id="msg"></div>',
+                '<div class="form-group">',
+                    '<input type="text" name="email" data-bv-emailaddress />',
+                '</div>',
+            '</form>'
+        ].join('\n')).appendTo('body');
+
+        $('#eventForm3')
+            .bootstrapValidator()
+            .on('success.field.bv', '[name="email"]', function(e, data) {
+                $('#msg').html('triggered success.field.bv on ' + data.field);
+            })
+            .on('error.field.bv', '[name="email"]', function(e, data) {
+                $('#msg').html('triggered error.field.bv on ' + data.field);
+            })
+            .on('bv.field.success', '[name="email"]', function(e, data) {
+                $('#msg').html('triggered bv.field.success on ' + data.field);
+            })
+            .on('bv.field.error', '[name="email"]', function(e, data) {
+                $('#msg').html('triggered bv.field.error on ' + data.field);
+            });
+
+        this.bv     = $('#eventForm3').data('bootstrapValidator');
+        this.$email = this.bv.getFieldElements('email');
+    });
+
+    afterEach(function() {
+        $('#eventForm3').bootstrapValidator('destroy').remove();
+    });
+
+    it('triggers success.field.bv', function() {
+        this.$email.val('email@domain.com');
+        this.bv.validate();
+        expect($('#msg').html()).toEqual('triggered success.field.bv on email');
+    });
+
+    it('does not trigger bv.field.success', function() {
+        this.$email.val('email@domain.com');
+        this.bv.validate();
+        expect($('#msg').html()).not.toEqual('triggered bv.field.success on email');
+    });
+
+    it('does not trigger error.field.bv', function() {
+        this.$email.val('email@domain');
+        this.bv.validate();
+        expect($('#msg').html()).toEqual('triggered error.field.bv on email');
+    });
+
+    it('triggers bv.field.error', function() {
+        this.$email.val('email@domain');
+        this.bv.validate();
+        expect($('#msg').html()).not.toEqual('triggered bv.field.error on email');
+    });
+});
+
+describe('event form trigger with events changed', function() {
+    beforeEach(function() {
+        $.fn.bootstrapValidator.DEFAULT_OPTIONS = $.extend({}, $.fn.bootstrapValidator.DEFAULT_OPTIONS, {
+            events: {
+                formInit: 'init.form.bv',
+                formError: 'bv.form.error',
+                formSuccess: 'bv.form.success',
+                fieldAdded: 'added.field.bv',
+                fieldRemoved: 'removed.field.bv',
+                fieldInit: 'init.field.bv',
+                fieldError: 'bv.field.error',
+                fieldSuccess: 'bv.field.success',
+                fieldStatus: 'status.field.bv',
+                validatorError: 'bv.validator.error',
+                validatorSuccess: 'success.validator.bv'
+            }
+        });
+
+        $([
+            '<form class="form-horizontal" id="eventForm2">',
+                '<div id="msg"></div>',
+                '<div class="form-group">',
+                    '<input type="text" name="email" data-bv-emailaddress />',
+                '</div>',
+            '</form>'
+        ].join('\n')).appendTo('body');
+
+        $('#eventForm2')
+            .bootstrapValidator()
+            .on('bv.form.success', function(e) {
+                $('#msg').html('form ' + $(e.target).attr('id') + ' triggered bv.form.success event');
+            })
+            .on('success.form.bv', function(e) {
+                $('#msg').html('form ' + $(e.target).attr('id') + ' triggered success.form.bv event');
+            })
+            .on('bv.form.error', function(e) {
+                $('#msg').html('form ' + $(e.target).attr('id') + ' triggered bv.form.error event');
+            })
+            .on('error.form.bv', function(e) {
+                $('#msg').html('form ' + $(e.target).attr('id') + ' triggered error.form.bv event');
+            });
+
+        this.bv     = $('#eventForm2').data('bootstrapValidator');
+        this.$email = this.bv.getFieldElements('email');
+    });
+
+    afterEach(function() {
+        $('#eventForm2').bootstrapValidator('destroy').remove();
+    });
+
+    it('triggers bv.form.success', function() {
+        this.$email.val('email@domain.com');
+        this.bv.validate();
+        expect($('#msg').html()).toEqual('form eventForm2 triggered bv.form.success event');
+    });
+
+    it('does not trigger success.form.bv', function() {
+        this.$email.val('email@domain.com');
+        this.bv.validate();
+        expect($('#msg').html()).not.toEqual('form eventForm2 triggered success.form.bv event');
+    });
+
+    it('triggers bv.form.error', function() {
+        spyOn(window, 'onerror');
+
+        this.$email.val('email@domain');
+        this.bv.validate();
+        expect($('#msg').html()).toEqual('form eventForm2 triggered bv.form.error event');
+
+        expect(window.onerror).not.toHaveBeenCalled();
+    });
+});
+
+describe('event field trigger with events changed', function() {
+    beforeEach(function () {
+        $.fn.bootstrapValidator.DEFAULT_OPTIONS = $.extend({}, $.fn.bootstrapValidator.DEFAULT_OPTIONS, {
+            events: {
+                formInit: 'init.form.bv',
+                formError: 'bv.form.error',
+                formSuccess: 'bv.form.success',
+                fieldAdded: 'added.field.bv',
+                fieldRemoved: 'removed.field.bv',
+                fieldInit: 'init.field.bv',
+                fieldError: 'bv.field.error',
+                fieldSuccess: 'bv.field.success',
+                fieldStatus: 'status.field.bv',
+                validatorError: 'bv.validator.error',
+                validatorSuccess: 'success.validator.bv'
+            }
+        });
+
+        $([
+            '<form class="form-horizontal" id="eventForm4">',
+                '<div id="msg"></div>',
+                '<div class="form-group">',
+                    '<input type="text" name="email" data-bv-emailaddress />',
+                '</div>',
+            '</form>'
+        ].join('\n')).appendTo('body');
+
+        $('#eventForm4')
+            .bootstrapValidator()
+            .on('success.field.bv', '[name="email"]', function(e, data) {
+                $('#msg').html('triggered success.field.bv on ' + data.field);
+            })
+            .on('error.field.bv', '[name="email"]', function(e, data) {
+                $('#msg').html('triggered error.field.bv on ' + data.field);
+            })
+            .on('bv.field.success', '[name="email"]', function(e, data) {
+                $('#msg').html('triggered bv.field.success on ' + data.field);
+            })
+            .on('bv.field.error', '[name="email"]', function(e, data) {
+                $('#msg').html('triggered bv.field.error on ' + data.field);
+            });
+
+        this.bv     = $('#eventForm4').data('bootstrapValidator');
+        this.$email = this.bv.getFieldElements('email');
+    });
+
+    afterEach(function() {
+        $('#eventForm4').bootstrapValidator('destroy').remove();
+    });
+
+    it('triggers success.field.bv', function() {
+        this.$email.val('email@domain.com');
+        this.bv.validate();
+        expect($('#msg').html()).not.toEqual('triggered success.field.bv on email');
+    });
+
+    it('does not trigger bv.field.success', function() {
+        this.$email.val('email@domain.com');
+        this.bv.validate();
+        expect($('#msg').html()).toEqual('triggered bv.field.success on email');
+    });
+
+    it('does not trigger error.field.bv', function() {
+        this.$email.val('email@domain');
+        this.bv.validate();
+        expect($('#msg').html()).not.toEqual('triggered error.field.bv on email');
+    });
+
+    it('triggers bv.field.error', function() {
+        spyOn(window, 'onerror');
+
+        this.$email.val('email@domain');
+        this.bv.validate();
+        expect($('#msg').html()).toEqual('triggered bv.field.error on email');
+
+        expect(window.onerror).not.toHaveBeenCalled();
+    });
+});
+
+// ---
 // Validator events
 // ---
+
 function onEmailAddressValidatorSuccess(e, data) {
     $('#msg').html(data.validator + ' validator passed');
 };

+ 46 - 47
test/spec/event.js

@@ -364,8 +364,8 @@ describe('event field programmatically', function() {
 // Modifying default events
 // ---
 
-describe('event form trigger with default events', function () {
-    beforeEach(function () {
+describe('event form trigger with default events', function() {
+    beforeEach(function() {
         $([
             '<form class="form-horizontal" id="eventForm1">',
                 '<div id="msg"></div>',
@@ -377,55 +377,54 @@ describe('event form trigger with default events', function () {
 
         $('#eventForm1')
             .bootstrapValidator()
-            .on('bv.form.success', function (e) {
+            .on('bv.form.success', function(e) {
                 $('#msg').html('form ' + $(e.target).attr('id') + ' triggered bv.form.success event');
             })
-            .on('success.form.bv', function (e) {
+            .on('success.form.bv', function(e) {
                 $('#msg').html('form ' + $(e.target).attr('id') + ' triggered success.form.bv event');
             })
-            .on('bv.form.error', function (e) {
+            .on('bv.form.error', function(e) {
                 $('#msg').html('form ' + $(e.target).attr('id') + ' triggered bv.form.error event');
             })
-            .on('error.form.bv', function (e) {
+            .on('error.form.bv', function(e) {
                 $('#msg').html('form ' + $(e.target).attr('id') + ' triggered error.form.bv event');
             });
 
-        this.bv = $('#eventForm1').data('bootstrapValidator');
+        this.bv     = $('#eventForm1').data('bootstrapValidator');
         this.$email = this.bv.getFieldElements('email');
     });
 
-    afterEach(function () {
+    afterEach(function() {
         $('#eventForm1').bootstrapValidator('destroy').remove();
     });
 
-    it('does not trigger bv.form.success', function () {
+    it('does not trigger bv.form.success', function() {
         this.$email.val('email@domain.com');
         this.bv.validate();
         expect($('#msg').html()).not.toEqual('form eventForm1 triggered bv.form.success event');
     });
 
-    it('triggers success.form.bv', function () {
+    it('triggers success.form.bv', function() {
         this.$email.val('email@domain.com');
         this.bv.validate();
         expect($('#msg').html()).toEqual('form eventForm1 triggered success.form.bv event');
     });
 
-    it('does not trigger bv.form.error', function () {
+    it('does not trigger bv.form.error', function() {
         this.$email.val('email@domain');
         this.bv.validate();
         expect($('#msg').html()).not.toEqual('form eventForm1 triggered bv.form.error event');
     });
 
-    it('triggers error.form.bv', function () {
+    it('triggers error.form.bv', function() {
         this.$email.val('email@domain');
         this.bv.validate();
         expect($('#msg').html()).toEqual('form eventForm1 triggered error.form.bv event');
-
     });
 });
 
-describe('event field trigger with default events', function () {
-    beforeEach(function () {
+describe('event field trigger with default events', function() {
+    beforeEach(function() {
         $([
             '<form class="form-horizontal" id="eventForm3">',
                 '<div id="msg"></div>',
@@ -437,54 +436,54 @@ describe('event field trigger with default events', function () {
 
         $('#eventForm3')
             .bootstrapValidator()
-            .on('success.field.bv', '[name="email"]', function (e, data) {
+            .on('success.field.bv', '[name="email"]', function(e, data) {
                 $('#msg').html('triggered success.field.bv on ' + data.field);
             })
-            .on('error.field.bv', '[name="email"]', function (e, data) {
+            .on('error.field.bv', '[name="email"]', function(e, data) {
                 $('#msg').html('triggered error.field.bv on ' + data.field);
             })
-            .on('bv.field.success', '[name="email"]', function (e, data) {
+            .on('bv.field.success', '[name="email"]', function(e, data) {
                 $('#msg').html('triggered bv.field.success on ' + data.field);
             })
-            .on('bv.field.error', '[name="email"]', function (e, data) {
+            .on('bv.field.error', '[name="email"]', function(e, data) {
                 $('#msg').html('triggered bv.field.error on ' + data.field);
             });
 
-        this.bv = $('#eventForm3').data('bootstrapValidator');
+        this.bv     = $('#eventForm3').data('bootstrapValidator');
         this.$email = this.bv.getFieldElements('email');
     });
 
-    afterEach(function () {
+    afterEach(function() {
         $('#eventForm3').bootstrapValidator('destroy').remove();
     });
 
-    it('triggers success.field.bv', function () {
+    it('triggers success.field.bv', function() {
         this.$email.val('email@domain.com');
         this.bv.validate();
         expect($('#msg').html()).toEqual('triggered success.field.bv on email');
     });
 
-    it('does not trigger bv.field.success', function () {
+    it('does not trigger bv.field.success', function() {
         this.$email.val('email@domain.com');
         this.bv.validate();
         expect($('#msg').html()).not.toEqual('triggered bv.field.success on email');
     });
 
-    it('does not trigger error.field.bv', function () {
+    it('does not trigger error.field.bv', function() {
         this.$email.val('email@domain');
         this.bv.validate();
         expect($('#msg').html()).toEqual('triggered error.field.bv on email');
     });
 
-    it('triggers bv.field.error', function () {
+    it('triggers bv.field.error', function() {
         this.$email.val('email@domain');
         this.bv.validate();
         expect($('#msg').html()).not.toEqual('triggered bv.field.error on email');
     });
 });
 
-describe('event form trigger with events changed', function () {
-    beforeEach(function () {
+describe('event form trigger with events changed', function() {
+    beforeEach(function() {
         $.fn.bootstrapValidator.DEFAULT_OPTIONS = $.extend({}, $.fn.bootstrapValidator.DEFAULT_OPTIONS, {
             events: {
                 formInit: 'init.form.bv',
@@ -512,40 +511,40 @@ describe('event form trigger with events changed', function () {
 
         $('#eventForm2')
             .bootstrapValidator()
-            .on('bv.form.success', function (e) {
+            .on('bv.form.success', function(e) {
                 $('#msg').html('form ' + $(e.target).attr('id') + ' triggered bv.form.success event');
             })
-            .on('success.form.bv', function (e) {
+            .on('success.form.bv', function(e) {
                 $('#msg').html('form ' + $(e.target).attr('id') + ' triggered success.form.bv event');
             })
-            .on('bv.form.error', function (e) {
+            .on('bv.form.error', function(e) {
                 $('#msg').html('form ' + $(e.target).attr('id') + ' triggered bv.form.error event');
             })
-            .on('error.form.bv', function (e) {
+            .on('error.form.bv', function(e) {
                 $('#msg').html('form ' + $(e.target).attr('id') + ' triggered error.form.bv event');
             });
 
-        this.bv = $('#eventForm2').data('bootstrapValidator');
+        this.bv     = $('#eventForm2').data('bootstrapValidator');
         this.$email = this.bv.getFieldElements('email');
     });
 
-    afterEach(function () {
+    afterEach(function() {
         $('#eventForm2').bootstrapValidator('destroy').remove();
     });
 
-    it('triggers bv.form.success', function () {
+    it('triggers bv.form.success', function() {
         this.$email.val('email@domain.com');
         this.bv.validate();
         expect($('#msg').html()).toEqual('form eventForm2 triggered bv.form.success event');
     });
 
-    it('does not trigger success.form.bv', function () {
+    it('does not trigger success.form.bv', function() {
         this.$email.val('email@domain.com');
         this.bv.validate();
         expect($('#msg').html()).not.toEqual('form eventForm2 triggered success.form.bv event');
     });
 
-    it('triggers bv.form.error', function () {
+    it('triggers bv.form.error', function() {
         spyOn(window, 'onerror');
 
         this.$email.val('email@domain');
@@ -556,7 +555,7 @@ describe('event form trigger with events changed', function () {
     });
 });
 
-describe('event field trigger with events changed', function () {
+describe('event field trigger with events changed', function() {
     beforeEach(function () {
         $.fn.bootstrapValidator.DEFAULT_OPTIONS = $.extend({}, $.fn.bootstrapValidator.DEFAULT_OPTIONS, {
             events: {
@@ -585,46 +584,46 @@ describe('event field trigger with events changed', function () {
 
         $('#eventForm4')
             .bootstrapValidator()
-            .on('success.field.bv', '[name="email"]', function (e, data) {
+            .on('success.field.bv', '[name="email"]', function(e, data) {
                 $('#msg').html('triggered success.field.bv on ' + data.field);
             })
-            .on('error.field.bv', '[name="email"]', function (e, data) {
+            .on('error.field.bv', '[name="email"]', function(e, data) {
                 $('#msg').html('triggered error.field.bv on ' + data.field);
             })
-            .on('bv.field.success', '[name="email"]', function (e, data) {
+            .on('bv.field.success', '[name="email"]', function(e, data) {
                 $('#msg').html('triggered bv.field.success on ' + data.field);
             })
-            .on('bv.field.error', '[name="email"]', function (e, data) {
+            .on('bv.field.error', '[name="email"]', function(e, data) {
                 $('#msg').html('triggered bv.field.error on ' + data.field);
             });
 
-        this.bv = $('#eventForm4').data('bootstrapValidator');
+        this.bv     = $('#eventForm4').data('bootstrapValidator');
         this.$email = this.bv.getFieldElements('email');
     });
 
-    afterEach(function () {
+    afterEach(function() {
         $('#eventForm4').bootstrapValidator('destroy').remove();
     });
 
-    it('triggers success.field.bv', function () {
+    it('triggers success.field.bv', function() {
         this.$email.val('email@domain.com');
         this.bv.validate();
         expect($('#msg').html()).not.toEqual('triggered success.field.bv on email');
     });
 
-    it('does not trigger bv.field.success', function () {
+    it('does not trigger bv.field.success', function() {
         this.$email.val('email@domain.com');
         this.bv.validate();
         expect($('#msg').html()).toEqual('triggered bv.field.success on email');
     });
 
-    it('does not trigger error.field.bv', function () {
+    it('does not trigger error.field.bv', function() {
         this.$email.val('email@domain');
         this.bv.validate();
         expect($('#msg').html()).not.toEqual('triggered error.field.bv on email');
     });
 
-    it('triggers bv.field.error', function () {
+    it('triggers bv.field.error', function() {
         spyOn(window, 'onerror');
 
         this.$email.val('email@domain');