lundi 19 septembre 2016

Unit testing component with angulartics2 - Can't bind to 'angularticsCategory' since it isn't a known property of 'div'

I am starting a project using Angular 2.0.0 stable release created with angular-cli 1.0.0-beta.14 and angulartics 1.1.9.

I am trying to start some simple unit testing and am recording clicks on a button component

<div class="sidebar-toggle" (click)="toggleSideBar()" angulartics2On="click" angularticsCategory="">
   //divContent
</div>

However, when I run the test which is simple bootstrapping the component I get the error

Can't bind to 'angularticsCategory' since it isn't a known property of 'div'

The app works fine but the issue only comes up in testing. I can't find an example where someone is having the same error in testing. I know I am missing something like not properly exposing the angulartics2 lib in my karma.conf OR not injecting the Angulartics or a mocked dependency in my Testbed config.

Really lost and would like to know if anyone is having similar problems. Can provide more code snippets if needed but don't want to dump the whole file nobody's got time to read that!

Aucun commentaire:

Enregistrer un commentaire