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
+22Lines changed: 22 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -165,6 +165,28 @@ const service = spectator.inject(QueryService, fromComponentInjector);
165
165
```ts
166
166
spectator.detectChanges();
167
167
```
168
+
169
+
-`detectComponentChanges()` - Runs `detectChanges` on the **tested** component ( not on the `host` ).
170
+
You'll need this method in __rare__ cases when using a `host` and the tested component is `onPush`, and you want to force it to run a change detection cycle.
171
+
172
+
```ts
173
+
spectator.detectComponentChanges();
174
+
```
175
+
176
+
-`setInput()` - Changes the value of an @Input() of the tested component.
177
+
Method runs `ngOnChanges` with `SimpleChanges` manually if it exists.
178
+
```ts
179
+
it('should...', () => {
180
+
spectator.setInput('className', 'danger');
181
+
182
+
spectator.setInput({
183
+
className: 'danger'
184
+
});
185
+
});
186
+
```
187
+
188
+
189
+
168
190
-`setInput()` - Changes the value of an @Input() of the tested component.
169
191
Method runs `ngOnChanges` with `SimpleChanges` manually if it exists.
0 commit comments