mercredi 1 avril 2015

Angular unit test mock constant

I have a directive that look like this:



.directive('myScroll', ['$compile','Config', function($compile,Config){
return {
scope: true,
link: function(scope, element) {
if(Config.showscroll){
element.attr('slimscroll', "{'height':menuheight,'alwaysVisible':true}");
element.removeAttr('my-scroll');
$compile(element)(scope);
}
}
};
}]);


The Config is an Angular constant. How can I do the testing by mocking that constant?


Aucun commentaire:

Enregistrer un commentaire