Problem: I would like to be able to unit test a directive in Angular 2 to make sure that it properly compiles.
In Angular 1, it was possible to use$compile(angular.element(myElement) service and call $scope.$digest() after that. I specifically want to be able to do this in unit tests so I could test that when Angular ends up running across <div my-attr-directive/> in the code that my-attr-directive compiles.
Constraints:
- Angular 2 using JAVASCRIPT. All sources somewhat related seem to require TS. Perhaps this resource truly does solve the problem and my understanding of TS is just that weak
- Unit Test in Jasmine
- Must be not be so hacky that my unit tests will eventually break. See a related SO post on compiling HTML manually in Angular 2
Aucun commentaire:
Enregistrer un commentaire