diff --git a/public/modules/forms/directives/field.client.directive.js b/public/modules/forms/directives/field.client.directive.js index 829ddaf9..d11d82ca 100644 --- a/public/modules/forms/directives/field.client.directive.js +++ b/public/modules/forms/directives/field.client.directive.js @@ -18,7 +18,6 @@ angular.module('forms').directive('fieldDirective', ['$templateCache', '$http', var templateUrl = 'modules/forms/views/directiveViews/field/'; var supported_fields = [ 'textfield', - 'welcome_page', 'email', 'textarea', 'checkbox', @@ -66,11 +65,11 @@ angular.module('forms').directive('fieldDirective', ['$templateCache', '$http', // } // GET template content from path - console.log(scope.field); var template = getTemplateUrl(scope.field); // $http.get(templateUrl).success(function(data) { - element.html(template); - $compile(element.contents())(scope); + element.html(template).show(); + // console.log(element.contents()); + $compile(element.contents())(scope); // }); }; diff --git a/public/modules/forms/tests/unit/directives/field.client.directive.test.js b/public/modules/forms/tests/unit/directives/field.client.directive.test.js index 196fee7b..834b121a 100644 --- a/public/modules/forms/tests/unit/directives/field.client.directive.test.js +++ b/public/modules/forms/tests/unit/directives/field.client.directive.test.js @@ -22,18 +22,18 @@ }; var sampleFields = [ - {fieldType:'textfield', title:'First Name', fieldValue: 'AoeuName', deletePreserved: false, required: true, disabled: false}, - {fieldType:'email', title:'Email', fieldValue: 'aoeu@aoeu.com', deletePreserved: false, required: true, disabled: false}, - {fieldType:'yes_no', title:'Do you Play Hockey?', fieldValue: 'true', deletePreserved: false, required: true, disabled: false}, - {fieldType:'checkbox', title:'Receive emails from us', fieldValue: '', deletePreserved: false, required: true, disabled: false}, - {fieldType:'url', title:'Github Account', fieldValue: 'http://github.com/aoeu', deletePreserved: false, required: true, disabled: false}, - {fieldType:'textarea', title:'Bio', fieldValue: 'This is my bio.', deletePreserved: false, required: true, disabled: false}, - {fieldType:'number', title:'Phone #', fieldValue: '5325325325', deletePreserved: false, required: true, disabled: false}, - {fieldType:'legal', title:'You agree to terms and conditions', description:'By selecting \'I agree\' you are agreeing under Canadian law that you have read and accept terms and conditions outlayed below', fieldValue: '', deletePreserved: false, required: true, disabled: false}, - {fieldType:'dropdown', title:'Your Sex', fieldValue: 'male', fieldOptions:[ { 'option_id': 0, 'option_title': 'M', 'option_value': 'male' }, { 'option_id': 1, 'option_title': 'F', 'option_value': 'female' }], deletePreserved: false, required: true, disabled: false}, - {fieldType:'radio', title:'Your Sexual Orientation', fieldValue: 'hetero', fieldOptions:[ { 'option_id': 0, 'option_title': 'Heterosexual', 'option_value': 'hetero' }, { 'option_id': 1, 'option_title': 'Homosexual', 'option_value': 'homo' }, { 'option_id': 2, 'option_title': 'Bisexual', 'option_value': 'bi' }, { 'option_id': 3, 'option_title': 'Asexual', 'option_value': 'asex' }], deletePreserved: false, required: true, disabled: false}, - {fieldType:'rating', title:'Your Current Happiness', fieldValue: '0', deletePreserved: false, required: true, disabled: false}, - ]; + {fieldType:'textfield', title:'First Name', fieldValue: 'AoeuName', deletePreserved: false, required: true, disabled: false}, + {fieldType:'email', title:'Email', fieldValue: 'aoeu@aoeu.com', deletePreserved: false, required: true, disabled: false}, + {fieldType:'yes_no', title:'Do you Play Hockey?', fieldValue: 'true', deletePreserved: false, required: true, disabled: false}, + {fieldType:'checkbox', title:'Receive emails from us', fieldValue: '', deletePreserved: false, required: true, disabled: false}, + {fieldType:'url', title:'Github Account', fieldValue: 'http://github.com/aoeu', deletePreserved: false, required: true, disabled: false}, + {fieldType:'textarea', title:'Bio', fieldValue: 'This is my bio.', deletePreserved: false, required: true, disabled: false}, + {fieldType:'number', title:'Phone #', fieldValue: 5325325325, deletePreserved: false, required: true, disabled: false}, + {fieldType:'legal', title:'You agree to terms and conditions', description:'By selecting \'I agree\' you are agreeing under Canadian law that you have read and accept terms and conditions outlayed below', fieldValue: '', deletePreserved: false, required: true, disabled: false}, + {fieldType:'dropdown', title:'Your Sex', fieldValue: 'male', fieldOptions:[ { 'option_id': 0, 'option_title': 'M', 'option_value': 'male' }, { 'option_id': 1, 'option_title': 'F', 'option_value': 'female' }], deletePreserved: false, required: true, disabled: false}, + {fieldType:'radio', title:'Your Sexual Orientation', fieldValue: 'hetero', fieldOptions:[ { 'option_id': 0, 'option_title': 'Heterosexual', 'option_value': 'hetero' }, { 'option_id': 1, 'option_title': 'Homosexual', 'option_value': 'homo' }, { 'option_id': 2, 'option_title': 'Bisexual', 'option_value': 'bi' }, { 'option_id': 3, 'option_title': 'Asexual', 'option_value': 'asex' }], deletePreserved: false, required: true, disabled: false}, + {fieldType:'rating', title:'Your Current Happiness', fieldValue: '0', deletePreserved: false, required: true, disabled: false}, + ]; // The $resource service augments the response object with methods for updating and deleting the resource. @@ -71,13 +71,22 @@ it('should be able to render all field types in html', inject(function($rootScope) { scope.fields = sampleFields; - for(var field in sampleFields){ + for(var i=0; i'); $compile(element)(scope); scope.$digest(); - expect(element.html()).not.toEqual('
'+field.title+'
'); + console.log('Actual: '); + console.log(element.html()); + + console.log('\nExpected: '); + + console.log('
'+field.title+'
'); } })); }); diff --git a/public/modules/forms/views/directiveViews/field/checkbox.html b/public/modules/forms/views/directiveViews/field/checkbox.html index c3dce436..56a25140 100755 --- a/public/modules/forms/views/directiveViews/field/checkbox.html +++ b/public/modules/forms/views/directiveViews/field/checkbox.html @@ -6,12 +6,12 @@ diff --git a/public/modules/forms/views/directiveViews/field/dropdown.html b/public/modules/forms/views/directiveViews/field/dropdown.html index 70694d92..c135f753 100755 --- a/public/modules/forms/views/directiveViews/field/dropdown.html +++ b/public/modules/forms/views/directiveViews/field/dropdown.html @@ -7,10 +7,13 @@
- diff --git a/public/modules/forms/views/directiveViews/field/radio.html b/public/modules/forms/views/directiveViews/field/radio.html index 278900fa..22a1b7a9 100755 --- a/public/modules/forms/views/directiveViews/field/radio.html +++ b/public/modules/forms/views/directiveViews/field/radio.html @@ -2,10 +2,10 @@

{{field.title}} *(required)

-