How to Unit Test a Directive In Angular 2?

后端 未结 2 1714
礼貌的吻别
礼貌的吻别 2020-12-28 12:32

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 possib

2条回答
  •  一向
    一向 (楼主)
    2020-12-28 12:48

    Took me a while to find a good example, a good person on angular gitter channel pointed me to look at the Angular Material Design 2 repository for examples. You can find a Directive test example here. This is the test file for the tooltip directive of Material Design 2. It looks like you have to test it as part of a component.

提交回复
热议问题