-
Notifications
You must be signed in to change notification settings - Fork 80
Open
Description
Steps to reproduce
- Directive being tested using the standard lineman angular template:
.directive('dlErrorValidationHandlerHelper', ['DLValidationService', '$templateCache',
function(DLValidationService, $templateCache ) {
return {
scope: true,
// I was not able to make this work with the unit tests; temnplate below did the work.
//templateUrl: function(tElement, tAttributes) {
// var validationType,
// validationDefinitionObject,
// templateUrl;
//
// if(!tAttributes.hasOwnProperty('validationType')) {
// throw "dlValidationDirective requires attribute: validationType";
// }
// validationType = tAttributes.validationType;
//
// validationDefinitionObject = DLValidationService.getVDO(validationType);
// if(validationDefinitionObject === null) {
// throw "dlValidationDirective unable to find validation definition object for: " + validationType;
// }
// templateUrl = validationDefinitionObject.templateUrl;
// var templateUrlString = $templateCache.get(templateUrl);
//
// console.log("templateUrl: " + templateUrl);
// console.log("templateUrlString: " + templateUrlString);
// return templateUrl;
//},
template: function(tElement, tAttributes) {
var validationType,
validationDefinitionObject,
templateUrl;
if(!tAttributes.hasOwnProperty('validationType')) {
throw "dlErrorValidationHandlerHelper requires attribute: validationType";
}
validationType = tAttributes.validationType;
validationDefinitionObject = DLValidationService.getVDO(validationType);
if(validationDefinitionObject === null) {
throw "dlErrorValidationHandlerHelper unable to find validation definition object for: " + validationType;
}
templateUrl = validationDefinitionObject.templateUrl;
var templateUrlString = $templateCache.get(templateUrl);
//console.log("templateUrl: " + templateUrl);
//console.log("templateUrlString: " + templateUrlString);
return templateUrlString;
},
controller: function($scope, $element, $attrs, $transclude) {
},
compile: function() {
return {
pre: function(scope, tElement, tAttributes) {
},
post: function(scope, iElement, iAttributes) {
//console.log("dlErrorValidationHandlerHelper_post: I was here");
scope.validationArgument = null;
if(iAttributes.hasOwnProperty('validationArgument')) {
scope.validationArgument = iAttributes.validationArgument;
}
}
};
}
};
}
])Observed behavior
- It does not work when using templateUrl. Note that the code is commented out.
- It works when using template in combination with _$templateCache.get().
Expected Behavior
- It works with templateUrl
I found references about how to use _ ng-html2js_ with Karma, but was not able to find similar documentation about how to configure TESTEM to use it. I suspect that it is there and that I missed it completely.
Regardless, thanks in advance for your help with this.
Regards
Rodrigo
Metadata
Metadata
Assignees
Labels
No labels