Hi there,
do you have an idea how to test that "myDirective" gets the
"promptBeforeDiscard" injected without testing it's functionality?
I mean I already tested the functionality of promptBeforeDiscard and what
to make sure that myDirective is just using it / is configured right.
Inside my direcitve tests I do sth like
it('should have attribute prompt-before-discard', function () {
expect(element.find('form[name="myForm"]')).to.have.attr('prompt-before-discard');
});
But this only ensures that the form has the desired attribute. It is still
possible to forget to include the dependency "promptBeforeDiscard" in the
below module declaration/configuration
angular.module("myDirective", ['myController', 'promptBeforeDiscard'])
.directive("myDirective", function () {
return {
restrict: 'E',
templateUrl: 'myDirective.html',
controller: 'myController',
scope: {
...
}
};
}
);
angular.module("promptBeforeDiscard", [])
.directive("promptBeforeDiscard", function ($window) {
...
}
);
Thanks, Leif
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.