From 5b2408f0a63bf2a6a053cb99d54fa6cb72c0b0eb Mon Sep 17 00:00:00 2001 From: Trevor Karjanis <2351292+TrevorKarjanis@users.noreply.github.com> Date: Mon, 26 Aug 2019 19:21:47 -0500 Subject: [PATCH] docs: fix typos in the routing and testing documentation (#32329) PR Close #32329 --- aio/content/guide/testing.md | 33 +++++++++++++++------------------ packages/router/src/router.ts | 2 +- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/aio/content/guide/testing.md b/aio/content/guide/testing.md index ff8c004017..6ee6846330 100644 --- a/aio/content/guide/testing.md +++ b/aio/content/guide/testing.md @@ -477,8 +477,7 @@ which covers testing with the `HttpClientTestingModule` in detail. A component, unlike all other parts of an Angular application, combines an HTML template and a TypeScript class. -The component truly is the template and the class _working together_. -and to adequately test a component, you should test that they work together +The component truly is the template and the class _working together_. To adequately test a component, you should test that they work together as intended. Such tests require creating the component's host element in the browser DOM, @@ -1120,7 +1119,7 @@ The first is a sanity test; it confirms that the stubbed `UserService` is called
The second parameter to the Jasmine matcher (e.g., `'expected name'`) is an optional failure label. -If the expectation fails, Jasmine displays appends this label to the expectation failure message. +If the expectation fails, Jasmine appends this label to the expectation failure message. In a spec with multiple expectations, it can help clarify what went wrong and which expectation failed.
@@ -1143,7 +1142,7 @@ The `TwainComponent` displays Mark Twain quotes. region="template" header="app/twain/twain.component.ts (template)"> -Note that value of the component's `quote` property passes through an `AsyncPipe`. +Note that the value of the component's `quote` property passes through an `AsyncPipe`. That means the property returns either a `Promise` or an `Observable`. In this example, the `TwainComponent.getQuote()` method tells you that @@ -1156,7 +1155,7 @@ the `quote` property returns an `Observable`. The `TwainComponent` gets quotes from an injected `TwainService`. The component starts the returned `Observable` with a placeholder value (`'...'`), -before the service can returns its first quote. +before the service can return its first quote. The `catchError` intercepts service errors, prepares an error message, and returns the placeholder value on the success channel. @@ -1251,9 +1250,9 @@ XHR calls within a test are rare, but if you need to call XHR, see [`async()`](# You do have to call `tick()` to advance the (virtual) clock. Calling `tick()` simulates the passage of time until all pending asynchronous activities finish. -In this case, it waits for the error handler's `setTimeout()`; +In this case, it waits for the error handler's `setTimeout()`. -The `tick()` function accepts milliseconds as parameter (defaults to 0 if not provided). The parameter represents how much the virtual clock advances. For example, if you have a `setTimeout(fn, 100)` in a `fakeAsync()` test, you need to use tick(100) to trigger the fn callback. +The `tick()` function accepts milliseconds as a parameter (defaults to 0 if not provided). The parameter represents how much the virtual clock advances. For example, if you have a `setTimeout(fn, 100)` in a `fakeAsync()` test, you need to use tick(100) to trigger the fn callback. -If you want to support such case, you need to define the `macroTask` you want to support in `beforeEach()`. +If you want to support such a case, you need to define the `macroTask` you want to support in `beforeEach()`. For example: ```javascript @@ -1351,7 +1350,7 @@ it('toBlob should be able to run in fakeAsync', fakeAsync(() => { You might be satisfied with the test coverage of these tests. -But you might be troubled by the fact that the real service doesn't quite behave this way. +However, you might be troubled by the fact that the real service doesn't quite behave this way. The real service sends requests to a remote server. A server takes time to respond and the response certainly won't be available immediately as in the previous two tests. @@ -1366,9 +1365,8 @@ from the `getQuote()` spy like this. #### Async observable helpers -The async observable was produced by an `asyncData` helper -The `asyncData` helper is a utility function that you'll have to write yourself. -Or you can copy this one from the sample code. +The async observable was produced by an `asyncData` helper. +The `asyncData` helper is a utility function that you'll have to write yourself, or you can copy this one from the sample code. diff --git a/packages/router/src/router.ts b/packages/router/src/router.ts index f617edd39f..18407840fd 100644 --- a/packages/router/src/router.ts +++ b/packages/router/src/router.ts @@ -863,7 +863,7 @@ export class Router { /** * Applies an array of commands to the current URL tree and creates a new URL tree. * - * When given an activate route, applies the given commands starting from the route. + * When given an activated route, applies the given commands starting from the route. * Otherwise, applies the given command starting from the root. * * @param commands An array of commands to apply.