@@ -11,7 +11,7 @@ deprecated and will be removed in version 10.
11
11
12
12
Since HammerJS previously was a requirement for a few Angular Material components, projects might
13
13
have installed ` HammerJS ` exclusively for Angular Material. Since HammerJS is no longer needed when
14
- updating to v9, the dependency on HammerJS can be removed if it's not used directly in the
14
+ updating to v9, the dependency on HammerJS can be removed if it's not used directly in your
15
15
application.
16
16
17
17
In some cases, projects use HammerJS events in templates while relying on Angular Material
@@ -21,29 +21,29 @@ these HammerJS events.
21
21
22
22
### What does the migration do?
23
23
24
- The migration automatically removes HammerJS from the project if HammerJS is not used.
24
+ The migration automatically removes HammerJS from your project if HammerJS is not used.
25
25
26
26
Additionally, Angular Material's ` GestureConfig ` (now deprecated) defined custom HammerJS gestures.
27
- If the application directly uses any of these gestures, the migration will introduce a new
27
+ If your application directly uses any of these gestures, the migration will introduce a new
28
28
application-specific configuration for these custom gestures, removing the dependency on Angular
29
29
Material's ` GestureConfig ` .
30
30
31
- Finally, if the application uses any of the custom HammerJS gestures provided by Angular Material's
31
+ Finally, if your application uses any of the custom HammerJS gestures provided by Angular Material's
32
32
` GestureConfig ` , or the default HammerJS gestures, the migration will add an import for Angular's
33
33
new ` HammerModule ` , which enabled HammerJS event bindings. These bindings were previously enabled
34
34
by default in Angular versions 8 and below.
35
35
36
36
If your application provides a custom [ ` HAMMER_GESTURE_CONFIG ` ] [ 1 ] and also references the
37
37
deprecated Angular Material ` GestureConfig ` , the migration will print a warning about
38
- ambiguous usage. The migration cannot migrate the project automatically and manual changes
38
+ ambiguous usage. The migration cannot migrate your project automatically and manual changes
39
39
are required. Read more [ in the dedicated section] ( #The-migration-reported-ambiguous-usage-What-should-I-do ) .
40
40
41
41
### How does the schematic remove HammerJS?
42
42
43
43
HammerJS can be set up in many ways. The migration handles the most common cases, covering
44
44
approaches recommended by Angular Material in the past. The migration performs the following steps:
45
45
46
- * 1\. * Remove ` hammerjs ` from the project ` package.json ` .
46
+ * 1\. * Remove ` hammerjs ` from your project ` package.json ` .
47
47
``` json
48
48
{
49
49
"dependencies" : {
@@ -62,7 +62,7 @@ import 'hammerjs';
62
62
63
63
The migration cannot automatically remove HammerJS from tests. Please manually clean up
64
64
the test setup and resolve any test issues. Read more in a
65
- [ dedicated section for test migration] ( #How-to-migrate-my-tests )
65
+ [ dedicated section for test migration] ( #How-to-migrate-my-tests ) .
66
66
67
67
### How do I migrate references to the deprecated ` GestureConfig ` ?
68
68
@@ -81,7 +81,7 @@ import {GestureConfig} from '@angular/material/core';
81
81
export class AppModule {}
82
82
```
83
83
84
- If this pattern is found in the project, it usually means that a component relies on the
84
+ If this pattern is found in your project, it usually means that a component relies on the
85
85
deprecated ` GestureConfig ` in order to use HammerJS events in the template. If this is the case,
86
86
the migration automatically creates a new gesture config which supports the used HammerJS
87
87
events. All references to the deprecated gesture config will be rewritten to the newly created one.
@@ -91,25 +91,25 @@ from the module. This is automatically done by the migration.
91
91
92
92
There are other patterns where the deprecated ` GestureConfig ` is extended, injected or used
93
93
in combination with a different custom gesture config. These patterns cannot be handled
94
- automatically, but the migration will report such patterns and ask for manual cleanup.
94
+ automatically, but the migration will report such patterns and ask you to perform manual cleanup.
95
95
96
96
<a name =" test-migration " ></a >
97
97
### How to migrate my tests?
98
98
99
99
Components in your project might use Angular Material components which previously depended
100
- on HammerJS. There might be unit tests for these components which also test gesture functionality
101
- of the Angular Material components. For such unit tests, find all failing gesture tests. These
102
- might need to be reworked to dispatch proper events to simulate gestures, or need to be deleted.
103
- Specifically gesture tests for the ` <mat-slide-toggle> ` should be removed. This is because the
104
- ` <mat-slide-toggle> ` no longer supports gestures.
100
+ upon HammerJS. There might be unit tests for these components which also test gesture functionality
101
+ of the Angular Material components. For such unit tests, identify all failing gesture tests. Then
102
+ you should rework these tests to dispatch proper events, in order to simulate gestures, or
103
+ delete the tests. Specifically gesture tests for the ` <mat-slide-toggle> ` should be removed.
104
+ This is because the ` <mat-slide-toggle> ` no longer supports gestures.
105
105
106
106
If some unit tests depend on the deprecated Angular Material ` GestureConfig ` to simulate gesture
107
- events, the reference should be either removed and tests reworked to use DOM events, or the
107
+ events, the reference should either be removed and tests reworked to use DOM events, or the
108
108
reference should be changed to the new gesture config created by the migration.
109
109
110
- If HammerJS has been removed by the migration from the project , you might able to need to
111
- clean up test setup that provides HammerJS. This is usually done in the test main file (usually
112
- in ` src/test.ts ` ) where ` hammerjs ` is imported.
110
+ If HammerJS has been removed from your project by the migration , you might need to refactor
111
+ the test setup that provides HammerJS. This is usually done in your test main file (usually
112
+ in ` src/test.ts ` ) where ` hammerjs ` may be imported.
113
113
114
114
``` typescript
115
115
import ' hammerjs' ;
@@ -128,15 +128,17 @@ plugin, or to an actual `@Output`. For example:
128
128
```
129
129
130
130
In the example above, ` rotate ` could be an event from the deprecated ` GestureConfig ` , or an
131
- ` @Output ` from ` <image-rotator> ` . The migration warns about this to raise awareness that it
132
- might have _ incorrectly kept_ HammerJS. Please manually check if you can remove HammerJS.
131
+ ` @Output ` from ` <image-rotator> ` . The migration warns you about this to raise awareness that it
132
+ might have _ incorrectly kept_ HammerJS. Please check if you can remove HammerJS from the project
133
+ manually.
133
134
134
135
** Case 2** : The deprecated Angular Material ` GestureConfig ` is used in combination with a
135
136
custom [ ` HAMMER_GESTURE_CONFIG ` ] [ 1 ] . This case is ambiguous because the migration is unable
136
137
to detect whether a given HammerJS event binding corresponds to the custom gesture config, or to
137
- the deprecated Angular Material gesture config. If such a warning has been reported to you, check
138
- if you can remove references to the deprecated ` GestureConfig ` , or if you need to handle the events
139
- provided by the deprecated gesture config in your existing custom gesture config.
138
+ the deprecated Angular Material gesture config. If such a warning has been reported, check
139
+ if you can remove the references to the deprecated ` GestureConfig ` , or if you need to update your
140
+ existing, custom gesture config to handle the events provided by the deprecated Angular Material
141
+ ` GestureConfig ` .
140
142
141
143
[ 1 ] : https://v9.angular.io/api/platform-browser/HammerGestureConfig
142
144
[ 2 ] : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#Import_a_module_for_its_side_effects_only
0 commit comments