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
Note that `await` statements block the execution of your test until the associated `Promise`
157
-
resolves. When reading multiple properties off a harness it may not be necessary to block on the
157
+
resolves. When reading multiple properties of a harness it may not be necessary to block on the
158
158
first before asking for the next, in these cases use `Promise.all` to parallelize.
159
159
160
160
For example, consider the following example of reading both the `checked` and `indeterminate` state
@@ -184,7 +184,7 @@ common components for a large Angular application.
184
184
The abstract `ComponentHarness` class is the base class for all component harnesses. To create a
185
185
custom component harness, extend `ComponentHarness` and implement the static property
186
186
`hostSelector`. The `hostSelector` property identifies elements in the DOM that match this harness
187
-
subclass. In most cases the `hostSelector` should be the same as the `selector` of the corresponding
187
+
subclass. In most cases, the `hostSelector` should be the same as the `selector` of the corresponding
188
188
`Component` or `Directive`. For example, consider a simple popup component:
189
189
190
190
```ts
@@ -285,7 +285,7 @@ unless its an element the component consumer defines directly (e.g. the host ele
285
285
`TestElement` instances for internal elements leads users to depend on a component's internal DOM
286
286
structure.
287
287
288
-
Instead, provide more narrow-focused methods for particular actions the enduser will
288
+
Instead, provide more narrow-focused methods for particular actions the end-user will
289
289
take or particular state they may want to check. For example, `MyPopupHarness` could provide methods
290
290
like `toggle` and `isOpen`:
291
291
@@ -322,7 +322,7 @@ earlier has an alternate signature that can be used for locating sub-harnesses r
322
322
|`locatorForOptional<T extends ComponentHarness>(harnessType: ComponentHarnessConstructor<T>): () => Promise<T \| null>`| Creates a function that returns a `Promise` for the first harness matching the given harness type when called. If no matching harness is found, the `Promise` is resolved with `null`. |
323
323
|`locatorForAll<T extends ComponentHarness>(harnessType: ComponentHarnessConstructor<T>): () => Promise<T[]>`| Creates a function that returns a `Promise` for a list of all harnesses matching the given harness type when called. |
324
324
325
-
For example consider a menu build using the popup shown above:
325
+
For example, consider a menu build using the popup shown above:
326
326
327
327
```ts
328
328
@Component({
@@ -498,10 +498,8 @@ class MyPopupHarness extends ComponentHarness {
498
498
499
499
#### Accessing elements outside of the component's host element
500
500
501
-
There are times when a component harness might need to access elements outside of it's corresponding
502
-
component's host element. A good example of this is components that use the
503
-
[CDK overlay](https://material.angular.io/cdk/overlay/overview). The CDK overlay creates an element
504
-
that is attached directly to the body, outside of the component's host element. In this case,
501
+
There are times when a component harness might need to access elements outside of its corresponding
502
+
component's host element. Components that use [CDK overlay](https://material.angular.io/cdk/overlay/overview) serve as examples of this. The CDK overlay creates an element that is attached directly to the body, outside of the component's host element. In this case,
505
503
`ComponentHarness` provides a method that can be used to get a `LocatorFactory` for the root element
506
504
of the document. The `LocatorFactory` supports most of the same APIs as the `ComponentHarness` base
507
505
class, and can then be used to query relative to the document's root element.
@@ -537,8 +535,8 @@ subsequent `NgZone` stabilization before animation events are fully flushed. In
537
535
needed, the `ComponentHarness` offers a `forceStabilize()` method that can be called to do the
538
536
second round.
539
537
540
-
Additionally some components may intentionally schedule tasks _outside_ of `NgZone`, this is
541
-
typically accomplished by using `NgZone.runOutsideAngular`. In this case the corresponding harness
538
+
Additionally, some components may intentionally schedule tasks _outside_ of `NgZone`, this is
539
+
typically accomplished by using `NgZone.runOutsideAngular`. In this case, the corresponding harness
542
540
may need to explicitly wait for tasks outside `NgZone`, as this does not happen automatically.
543
541
`ComponentHarness` offers a method called `waitForTasksOutsideAngular` for this purpose.
544
542
@@ -560,7 +558,7 @@ The first step in adding support for a new testing environment is to create a `T
560
558
implementation. The `TestElement` interface serves as an environment-agnostic representation of a
561
559
DOM element; it lets harnesses interact with DOM elements regardless of the underlying environment.
562
560
Because some environments don't support interacting with DOM elements synchronously
563
-
(e.g. webdriver), all of `TestElement` methods are asynchronous, returning a `Promise` with the
561
+
(e.g. webdriver), all of the `TestElement` methods are asynchronous, returning a `Promise` with the
564
562
result of the operation.
565
563
566
564
| Method | Description |
@@ -599,7 +597,7 @@ Test authors use `HarnessEnvironemnt` to create component harness instances for
599
597
600
598
`HarnessEnvironment` is an abstract class that must be extended to create a concrete subclass for
601
599
the new environment. When supporting a new test environment, you must create a `HarnessEnvironment`
602
-
subclass that add concrete implementations for all abstract members.
600
+
subclass that adds concrete implementations for all abstract members.
603
601
604
602
You will notice that `HarnessEnvironment` has a generic type parameter: `HarnessEnvironment<E>`.
605
603
This parameter, `E`, represents the raw element type of the environment. For example, this parameter
0 commit comments