galvan
galvan

Reputation: 7486

Ionic2 - how to write unit test for a @Page

I'm interesting in writing a unit tests for every @Page in my Ionic2 application (using angular2 and typescript). All posts with testing angular2 application has references for writing tests for a @Component. My question is, does a @Page is similar to @Component? Can I test it which the same techniques or should I use any Ionic2 test frameworks?

Thanks for the help.

Upvotes: 1

Views: 574

Answers (1)

Thierry Templier
Thierry Templier

Reputation: 202346

From the Ionic2 documentation (http://ionicframework.com/docs/v2/getting-started/tutorial/adding-pages/):

Page - an Angular component with all Ionic directives already provided, to be loaded using Ionic’s navigation system

If you have a look at the source code of the @Page decorator, you will see that a Component is set into the annotations of the class:

For such reasons, you can use the same approach to test pages than for components.

Upvotes: 2

Related Questions