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
{{ message }}
This repository was archived by the owner on Dec 4, 2017. It is now read-only.
Copy file name to clipboardExpand all lines: public/docs/ts/latest/guide/application-under-test.jade
+6-5Lines changed: 6 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -3,17 +3,18 @@ include ../../../../_includes/_util-fns
3
3
:markdown
4
4
We’ll need an Angular application to test, one as simple as possible while having all the angular features we want to test.
5
5
6
-
We have such an app that you can download [here](./#). It’s a one-screen variation on the “Tour of Heroes” that should be familiar to you as a reader of this Developers Guide.
6
+
<!-- TODO We have such an app that you can download [here](./#). -->It’s a one-screen variation on the “Tour of Heroes” that should be familiar to you as a reader of this Developers Guide.
7
7
8
8
Our test app displays a list of heroes - all favorites of the user named “Bongo”. It looks like this:
At the top is a master list of heroes; at the bottom the detail for the current hero. Click a hero in the list to change the current hero. Change the name in the textbox and that name updates everywhere. The *Update* button modifies the `Hero.name` in an arbitrary way and that change also propagates everywhere on screen. The *Delete* button deletes the hero from the list and a new hero becomes current. *Refresh* clears both the list and detail, then restores the original list of heroes.
15
16
16
-
You can see a short video of the app in action [here](./#)
17
+
<!-- TODO You can see a short video of the app in action [here](./#) -->
17
18
18
19
This simple app illustrates a number of Angular features that we’d like to test.
19
20
@@ -26,8 +27,8 @@ figure.image-display
26
27
- The `name` textbox illustrates two-way databinding
27
28
- The update button demonstrates that a programmatic change to the databound model propagates to both component views
28
29
- The delete button triggers an event that is caught by the parent component
29
-
- [TBD: need to add a filter and a directive to this sample]
30
-
- [TBD: need to shoehorn the router in somehow]
30
+
<!-- TODO - [TBD: need to add a filter and a directive to this sample] -->
31
+
<!-- TODO - [TBD: need to shoehorn the router in somehow] -->
31
32
32
33
We’ll examine the implementation details as we evolve our tests.
Copy file name to clipboardExpand all lines: public/docs/ts/latest/guide/first-app-tests.jade
+4-6Lines changed: 4 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -15,8 +15,7 @@ include ../../../../_includes/_util-fns
15
15
16
16
- you’ve learned the basics of Angular 2, from this Developers Guide or elsewhere. We won’t re-explain the Angular 2 architecture, its key parts, or the recommended development techniques.
17
17
you’ve read the [Jasmine 101](./jasmine-testing-101.html) chapter.
18
-
19
-
- you’ve downloaded the [Heroes application we’re about to test](./#).
18
+
- you’ve downloaded the [Heroes application we’re about to test](./#). <!-- TODO add link -->
20
19
21
20
## Create the test-runner HTML
22
21
@@ -55,9 +54,7 @@ include ../../../../_includes/_util-fns
- load multiple test files in our test harness, using system.js
35
35
36
-
.alert.is-critical
37
-
:markdown
38
-
This chapter assumes familiarity with basic Angular 2 concepts, the tools we introduced in [Getting Started](./gettingStarted.html) and [Tour of Heroes](./#), and earlier chapters of this Unit Testing series.
36
+
.callout.is-helpful
37
+
header Prior Knowledge
38
+
p This chapter assumes familiarity with basic Angular 2 concepts, the tools we introduced in <ahref="./gettingStarted.html">Getting Started</a> and <ahref="./toh-pt1.html">Tour of Heroes</a>, and earlier chapters of this Unit Testing series.
39
39
40
40
:markdown
41
41
## Add the Angular library
@@ -49,7 +49,8 @@ figure.image-display
49
49
:markdown
50
50
If we then opened the browser’s Developer Tools (F12, Ctrl-Shift-I) and looked in the console window, we would see.
Copy file name to clipboardExpand all lines: public/docs/ts/latest/guide/toh-pt1.jade
+35-22Lines changed: 35 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -17,25 +17,26 @@ include ../../../../_includes/_util-fns
17
17
18
18
We’ll cover just enough of the core fundamentals to get us started and build an app. Since we are covering a lot of ground, we’ll be able to go deeper on topics by following links as we go.
19
19
20
-
Selectable List of Heroes
20
+
**Selectable List of Heroes**
21
21
figure.image-display
22
22
img(src='/resources/images/devguide/toh/heroes-list-1.png'alt="Output of heroes list app")
23
23
24
24
:markdown
25
-
Hero Details
25
+
**Hero Details**
26
26
figure.image-display
27
27
img(src='/resources/images/devguide/toh/hero-details-1.png'alt="Details of hero in app")
28
28
29
29
:markdown
30
30
### **This is How We Roll**
31
31
We’ll be building the Tour of Heroes together, step by step. Along the way we’ll learn many of the core fundamentals of Angular 2 as we construct the application. Each step is motivated by a requirement. Everything has a reason. We’ll motivate the direction the Tour of Heroes takes, and learn how to solve common application needs with Angular 2’s fundamentals.
32
32
33
-
## Getting Started
33
+
## Initial App Setup
34
+
<aside class="is-right">Find the basics of app setup in the Getting Started chapter.</aside>
34
35
35
36
### **Creating Tour of Heroes**
36
-
After following Getting Started, copy the code to a new folder and rename the folder `angular2-tour-of-heroes`
37
37
38
-
*Sidenote: Follow the Getting Start guide in the [getting started chapter]*
38
+
After following [Getting Started](../guide/gettingStarted.html), copy the code to a new folder and rename the folder
39
+
`angular2-tour-of-heroes`
39
40
40
41
Our starting app from Getting Started should look like the following structure:
41
42
@@ -66,13 +67,20 @@ include ../../../../_includes/_util-fns
66
67
:markdown
67
68
This will keep the application running while we continue to build the Tour of Heroes.
68
69
69
-
Note: These steps will watch the existing files and recompile and re-run the app when they change. However, if you notice the watchers do not pick up renamed or new files, stop these commands in terminal by typing `CTRL+C` and then re-run both commands.
70
+
<!--TODO: style this with callout style and set a header-->Note: These steps will watch the
71
+
existing files and
72
+
recompile
73
+
and re-run
74
+
the app
75
+
when they
76
+
change. However, if you notice the watchers do not pick up renamed or new files, stop these commands in terminal by typing `CTRL+C` and then re-run both commands.
70
77
71
78
.l-main-section
72
79
73
80
:markdown
74
81
## Let's Show our Hero
75
-
We want to show data in our app, so let’s start by creating a title for our Tour of Heroes. We’ll also create a hero and display him.
82
+
We want to show data in our app, so let’s start by creating a title for our Tour of Heroes.
83
+
We’ll also create a hero and display her.
76
84
77
85
### **Displaying Data**
78
86
We need to add properties in our component to store the title and the hero’s name. Let’s create `title` and `hero` properties in the component. We’ll set the title to Tour of Heroes and set the hero to Windstorm.
@@ -96,10 +104,11 @@ include ../../../../_includes/_util-fns
96
104
97
105
The curly braces tell our app to read the `title` and `hero` properties from the component and render them.
98
106
99
-
*Sidenote: Learn more about one-way binding in the [data binding chapter]*
107
+
Learn more about one-way binding in the <!--TODO link-->Data Binding chapter.
100
108
101
109
### **Hero Object**
102
-
Our hero has a name, but we want to him to have more properties. We’ll do this in TypeScript by creating a `Hero` class.
110
+
Our hero has a name, but we want to her to have more properties. We’ll do this in TypeScript
111
+
by creating a `Hero` class.
103
112
104
113
Let’s create the `Hero` class with `id` and `name` properties. We’ll put this in the `app.ts` file for now.
105
114
@@ -191,7 +200,8 @@ include ../../../../_includes/_util-fns
191
200
192
201
Let’s fix that next by letting Angular know we want to use the ng-model directive.
193
202
194
-
*Sidenote: Learn more about ng-model in the [data binding chapter]*
203
+
<!-- TODO style with a class and add a link *Sidenote: Learn more about ng-model in the [data
204
+
binding chapter]* -->
195
205
196
206
### **FORM Directives**
197
207
We just used the `ng-model` directive, but we must tell the component which directives we will use in the template. When we know which directives we want to use, we can import them from Angular 2 and tell the component’s view that we want to use them.
@@ -239,19 +249,22 @@ include ../../../../_includes/_util-fns
239
249
240
250
Angular bundles all the binding directives for forms together into `FORM_DIRECTIVES`. This is all we need to remember to light up our template. Fortunately, we can bundle a collection of directives together in an array, give it a catchy name, and we can plug that array into the `directives` property.
241
251
242
-
*Sidenote: Learn more about Angular 2 Forms in the [Forms chapter]*
252
+
<!-- TODO *Sidenote: Learn more about Angular 2 Forms in the [Forms chapter]* -->
243
253
244
254
## Recap
245
255
246
256
### **The Road We’ve Travelled**
247
-
Let’s take stock in what we’ve built.
248
-
249
-
> [formatting = undordered list. how?]
250
-
> Our Tour of Heroes now includes one-way data binding to display a hero by wrapping properties with double curly braces in our template.
251
-
> || We added two-way data binding so we can change the hero’s name and see those changes throughout all places the hero’s name is bound in the template.
252
-
> || We built our template in the component’s file using ES2015’s template strings feature.
253
-
> || We declared that we use the Form directives in our component and view.
254
-
> || We used the special built-in `ng-model` directive with the `<input>` element to make the hero’s name display in the template. `ng-model` also helps us propagate any changes we make throughout all places bound to `hero.name` in the template.
255
-
256
-
### **The Road Ahead**
257
-
Our Tour of Heroes only displays one hero and we really want to display a list of heroes. We also want to allow the user to select a hero and display his details. We’ll learn more about how to retrieve lists, bind them to the template, and allow a user to select it in the next chapter.
257
+
Let’s take stock of what we’ve built.
258
+
259
+
* Our Tour of Heroes now includes one-way data binding to display a hero by wrapping
260
+
properties with double curly braces in our template.
261
+
* We added two-way data binding so we can change the hero’s name and see those changes throughout all places the hero’s name is bound in the template.
262
+
* We built our template in the component’s file using ES2015’s template strings feature.
263
+
* We declared that we use the Form directives in our component and view.
264
+
* We used the special built-in `ng-model` directive with the `<input>` element to make the hero’s name display in the template. `ng-model` also helps us propagate any changes we make throughout all places bound to `hero.name` in the template.
265
+
266
+
<!-- TODO: Add this in when the next chapter exists ### **The Road Ahead**
267
+
Our Tour of Heroes only displays one hero and we really want to display a list of heroes. We also want to allow the user to select a hero and display their details. We’ll learn more about
268
+
how to retrieve lists, bind them to the
269
+
template, and
270
+
allow a user to select it in the next chapter. -->
Copy file name to clipboardExpand all lines: public/docs/ts/latest/guide/unit-testing-01.jade
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -64,6 +64,7 @@ figure.image-display
64
64
* when to mock and how
65
65
66
66
## Unit Testing Chapters
67
+
<!-- TODO This toc feels out of place here -->
67
68
68
69
Here is what we’ll learn in the unit testing chapters.
69
70
@@ -111,9 +112,8 @@ figure.image-display
111
112
It’s a big agenda. Fortunately, you can learn a little bit at a time and put each lesson to use.
112
113
113
114
.callout.is-helpful
114
-
p These Unit Testing chapters build upon each other. We recommend reading them in order. <br/>We assume familiarity with basic Angular 2 concepts and the tools we introduced in
115
-
<ahref="./gettingStarted.html">Getting Started</a> and
116
-
<ahref="./toh-pt1.html">Tour of Heroes</a> such as `npm`, `gulp`, and `live-server`.
115
+
header How to Use This Guide
116
+
p The three Unit Testing chapters build upon each other. We recommend reading them in order. We're also assuming that you're already comfortable with basic Angular 2 concepts and the tools we introduced in <ahref="./gettingStarted.html">Getting Started</a> and <ahref="./toh-pt1.html">Tour of Heroes</a> such as <code>npm</code>, <code>gulp</code>, and <code>live-server</code>.
0 commit comments