Skip to content

Commit 3004c00

Browse files
docs(angular): document importOverrides (#1542)
1 parent aa0c724 commit 3004c00

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

  • docs/angular-testing-library

docs/angular-testing-library/api.mdx

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,25 @@ await render(AppComponent, {
252252
})
253253
```
254254

255-
### `componentImports`
255+
### `importOverrides`
256256

257-
A collection of imports to override a standalone component's imports with.
257+
A collection of import overrides to replace specific imports of a standalone component without replacing the entire imports array. Each entry specifies which import to `replace` and what to replace it `with`. This is the preferred alternative to `componentImports` when you only want to stub a subset of a component's imports.
258+
259+
**default** : `undefined`
260+
261+
**example**:
262+
263+
```typescript
264+
await render(AppComponent, {
265+
importOverrides: [
266+
{ replace: ChildComponent, with: MockChildComponent },
267+
],
268+
})
269+
```
270+
271+
### ~~`componentImports`~~ (deprecated)
272+
273+
A collection of imports to override **all** of a standalone component's imports with. Prefer [`importOverrides`](#importOverrides) when you only need to replace specific imports.
258274

259275
**default** : `undefined`
260276

0 commit comments

Comments
 (0)