mardi 24 février 2015

Mocking a directive with angularjs

I know there is $controllerProvider which can be used, to create controllers inside unit tests. I'm wondering however if there is a way to mock a directive inside of a unit test.


The background to this is, that I'm trying to mock(! not to create) a directive which is applying an async validator to ngModel. Perfect would be something like this:



beforeEach(function () {
module('myMod', function($directiveProvider) {
$directiveProvider.register('mockAsyncValidationDirective', function() {
return {
restrict: 'EA',
require: 'ngModel'
// ...
}
});
});
});


Is there any way to do that?


Aucun commentaire:

Enregistrer un commentaire