Merged xosValidation pull-request
diff --git a/views/ngXosLib/xosHelpers/spec/services/helpers/form.helpers.test.js b/views/ngXosLib/xosHelpers/spec/services/helpers/form.helpers.test.js
index 404f63a..f6bfbb2 100644
--- a/views/ngXosLib/xosHelpers/spec/services/helpers/form.helpers.test.js
+++ b/views/ngXosLib/xosHelpers/spec/services/helpers/form.helpers.test.js
@@ -43,7 +43,8 @@
         custom: {
           label: 'Custom Label',
           type: 'number',
-          validators: {}
+          validators: {},
+          hint: 'Test Hint'
         }
       };
 
@@ -51,32 +52,38 @@
         id: {
           label: 'Id:',
           type: 'number',
-          validators: {}
+          validators: {},
+          hint: ''
         },
         name: {
           label: 'Name:',
           type: 'text',
-          validators: {}
+          validators: {},
+          hint: ''
         },
         mail: {
           label: 'Mail:',
           type: 'email',
-          validators: {}
+          validators: {},
+          hint: ''
         },
         active: {
           label: 'Active:',
           type: 'boolean',
-          validators: {}
+          validators: {},
+          hint: ''
         },
         created: {
           label: 'Created:',
           type: 'date',
-          validators: {}
+          validators: {},
+          hint: ''
         },
         custom: {
           label: 'Custom Label:',
           type: 'number',
-          validators: {}
+          validators: {},
+          hint: 'Test Hint'
         }
       };
 
@@ -176,7 +183,8 @@
           },
           custom: {
             label: 'Custom Label',
-            type: 'number'
+            type: 'number',
+            hint: 'Test Hint'
           }
         };
 
@@ -184,32 +192,38 @@
           id: {
             label: 'Id:',
             type: 'number',
-            validators: {}
+            validators: {},
+            hint: ''
           },
           name: {
             label: 'Name:',
             type: 'text',
-            validators: {}
+            validators: {},
+            hint: ''
           },
           mail: {
             label: 'Mail:',
             type: 'email',
-            validators: {}
+            validators: {},
+            hint: ''
           },
           active: {
             label: 'Active:',
             type: 'boolean',
-            validators: {}
+            validators: {},
+            hint: ''
           },
           created: {
             label: 'Created:',
             type: 'date',
-            validators: {}
+            validators: {},
+            hint: ''
           },
           custom: {
             label: 'Custom Label:',
             type: 'number',
-            validators: {}
+            validators: {},
+            hint: 'Test Hint'
           }
         };
 
diff --git a/views/ngXosLib/xosHelpers/spec/ui/validation.test.js b/views/ngXosLib/xosHelpers/spec/ui/validation.test.js
index 782f03f..bb663fa 100644
--- a/views/ngXosLib/xosHelpers/spec/ui/validation.test.js
+++ b/views/ngXosLib/xosHelpers/spec/ui/validation.test.js
@@ -7,27 +7,46 @@
 (function () {
   'use strict';
 
+  let compile, element, scope, isolatedScope;
+
+  const compileElement = (el) => {
+    element = el;
+
+    if(!scope){
+      scope = rootScope.$new();
+    }
+    if(!angular.isDefined(element)){
+      element = angular.element('<xos-validation field="field" form="form"></xos-validation>');
+    }
+    compile(element)(scope);
+    scope.$digest();
+    isolatedScope = element.isolateScope().vm;
+  }
+
   describe('The xos.helper module', function(){
     describe('The xos-validation component', () => {
 
-      let element, scope, isolatedScope;
-
       beforeEach(module('xos.helpers'));
 
-      beforeEach(inject(($compile, $rootScope) => {
+      describe('when the form has no errors', () => {
+        beforeEach(inject(($compile, $rootScope) => {
+          compile = $compile;
+          scope = $rootScope.$new();
 
-        scope = $rootScope.$new();
+          scope.field = {
+            $error: {}
+          };
 
-        scope.errors = {};
+          scope.form = {
+            $submitted: true
+          }
 
-        element = angular.element(`<xos-validation errors="errors"></xos-validation>`);
-        $compile(element)(scope);
-        scope.$digest();
-        isolatedScope = element.isolateScope().vm;
-      }));
+          compileElement();
+        }));
 
-      it('should not show an alert', () => {
-        expect($(element).find('xos-alert > .alert')[0]).toHaveClass('ng-hide');
+        it('should not show an alert by default', () => {
+          expect($(element).find('xos-alert > .alert')[0]).toHaveClass('ng-hide');
+        });
       });
 
       let availableErrors = [
@@ -56,8 +75,8 @@
       // use a loop to generate similar test
       availableErrors.forEach((e, i) => {
         it(`should show an alert for ${e.type} errors`, () => {
-          scope.errors[e.type] = true;
-          scope.$digest();
+          scope.field.$error[e.type] = true;
+          compileElement();
           let alert = $(element).find('xos-alert > .alert')[i];
           expect(alert).not.toHaveClass('ng-hide');
           expect(alert).toHaveText(e.message);