Skip to content

Commit 39ba0dd

Browse files
committed
docs: ✏️ add detectComponentChanges section
Closes: #425
1 parent e00020e commit 39ba0dd

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,28 @@ const service = spectator.inject(QueryService, fromComponentInjector);
165165
```ts
166166
spectator.detectChanges();
167167
```
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+
168190
- `setInput()` - Changes the value of an @Input() of the tested component.
169191
Method runs `ngOnChanges` with `SimpleChanges` manually if it exists.
170192
```ts

0 commit comments

Comments
 (0)