You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+43-26Lines changed: 43 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,47 @@
4
4
5
5
Special thanks to all of the contributors. With the exception of the Ionic team's updates to the framework, this project is stable. If you have a suggestion, feel free to update code and make a pull request. Find a problem or bug, feel free to file a detailed issue.
6
6
7
-
## UPDATES:
7
+
## How to Configure Your Ionic Application for Testing
8
+
9
+
Read [this tutorial](https://leifwells.github.io/2017/08/27/testing-in-ionic-configure-existing-projects-for-testing/) for instructions on how to apply the testing configuration in this project to your own project.
10
+
11
+
## Mocking Classes for Ionic
12
+
When a developer unit tests a component, the objective is to isolate that component as much as possible. In the case of an Ionic page, you may have Ionic components like `NavController`, `LoadingContoller`, or `Platform`. Adding these components means adding pieces of the Ionic framework to your test, thus not isolating the component. As part of this example, the file `test-config/mocks-ionic.ts` is provided for creating simple mocks for many of the classes in Ionic that you may need. You may use the classes from this file in test files inside the `TestBed.configureComponent()` method argument's `provider` array as seen in our [example unit test file](https://github.com/ionic-team/ionic-unit-testing-example/blob/master/src/app/app.component.spec.ts).
13
+
14
+
There are other mocking options that should be mentioned:
Also worth mentioning is [ionic-native-mocks](https://github.com/chrisgriffith/ionic-native-mocks) which can be helpful when mocks for Ionic Native classes used in your project are needed.
19
+
20
+
Getting Started with this Project
21
+
-----------
22
+
23
+
To get started, clone this repo, and run `npm install` in the root directory.
Then, you should run `ionic serve` to make sure the project loads.
31
+
32
+
### Unit Tests
33
+
34
+
To run the tests, run `npm run test`.
35
+
36
+
See the example test in `src/app/app.component.spec.ts` for an example of a component test.
37
+
38
+
### End-To-End Tests (Browser-Only)
39
+
40
+
To serve the app, run `ionic serve`.
41
+
42
+
To run the end-to-end tests, run (while the app is being served) `npm run e2e`.
43
+
44
+
See the example end-to-end test in `e2e/app.e2e-spec.ts`.
45
+
46
+
UPDATES:
47
+
==========
8
48
### **2017-08-26: Update to `ionic-angular` version 3.6.0**
9
49
10
50
We updated the project to `ionic-angular` version `3.6.0`. Developers wishing to use this should also update Ionic CLI for a better experience. With today's update, this project is now at version `0.0.5`.
@@ -19,20 +59,16 @@ Thanks to [@datencia](https://github.com/datencia) for providing an update to ou
19
59
20
60
Thanks (again) to [@danielsogl](https://github.com/danielsogl/) for providing a code update to the project so that our code matches code created by using the `ionic start` command. Having this code properly match is important as it provides the best practice guidance for handling application start up.
21
61
22
-
## How to Configure Your Ionic Application for Testing
23
-
24
-
Read [this tutorial](https://leifwells.github.io/2017/08/27/testing-in-ionic-configure-existing-projects-for-testing/) for instructions on how to apply the testing configuration in this project to your own project.
25
-
26
62
## Looking for Version 2?
27
63
28
64
If you are using Ionic v2, please see our [ionic-v2-branch](https://github.com/ionic-team/ionic-unit-testing-example/tree/ionic-v2-branch).
29
65
30
-
31
66
## Credits
32
67
33
68
This repository is based on the awesome [unit testing example](https://github.com/roblouie/unit-testing-demo) from [@roblouie](https://github.com/roblouie/):thumbsup:
34
69
35
-
## Past Changes
70
+
Past Updates
71
+
==========
36
72
#### *2017-05-28: Update to Version 3.3.0*
37
73
38
74
Thanks to [@danielsogl](https://github.com/danielsogl/) for getting us up-to-date with Ionic 3.3.0, Angular 4.1.2 and Ionic Native 3.10.2.
@@ -51,22 +87,3 @@ npm remove -g ionic
51
87
npm install -g ionic
52
88
```
53
89
If you run `ionic -v` it should return `3.0.0` (or better, depending on what has been released.
54
-
55
-
## Getting Started
56
-
-----------
57
-
58
-
To get started, clone this repo, and run `npm install` in the root directory.
59
-
60
-
### Unit Tests
61
-
62
-
To run the tests, run `npm test`.
63
-
64
-
See the example test in `src/app/app.component.spec.ts` for an example of a component test.
65
-
66
-
### End-To-End Tests (Browser-Only)
67
-
68
-
To serve the app, run `ionic serve`.
69
-
70
-
To run the end-to-end tests, run (while the app is being served) `npm run e2e`.
71
-
72
-
See the example end-to-end test in `e2e/app.e2e-spec.ts`.
0 commit comments