I have created a custom directive that has a watch for a couple of isolated scope properties, here is the relevant code:
scope.$watchGroup(['repairer', 'initial'], function () {
scope.Repairer = null;
...
scriptingService.getScript(request).then(function (scripts) {
scope.scripts = scripts;
});
I wrote a couple of test but none of them work,this is one of them:
it('should Repairer be 2', function() {
scope.$apply(function() {
scope.initial = 2;
});
expect(element.isolateScope().Repairer).toEqual(2);
});
But I am getting an error:
TypeError: Cannot read property 'Repairer' of undefined
How can I make the tests work? Looks like the directive is somehow not running in the test.
Here is a plunkerref:http://ift.tt/21sciDv
Aucun commentaire:
Enregistrer un commentaire