I am trying to mock a directive that resides on the same module of it's parent. Since i want to isolate the test to just the child directive i am trying to mock the parent. It would be easily feasible if they both resided on different modules but since they are on the same i get multiple directives with the same name. To bypass that i tried to put something like this on my mock directive:
return {
priority: 100,
terminal:true,
restrict:'CE',
scope:{
zoom:'@'
},
template:'<div ng-transclude></div>',
controllerAs:'parentController',
controller:mockController,
transclude: true
};
The problem is that while i can override the parent directive doing so, the child directive is never called since it has a lower priority and terminal will halt the execution.
What i am in search of is a way to override a directive definition while testing on karma-jasmine and using angular.mock.
Aucun commentaire:
Enregistrer un commentaire