Skip to content

docs(angular-testing-library): update rerender api #1249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 1 addition & 22 deletions docs/angular-testing-library/api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -388,27 +388,6 @@ const {debug} = await render(AppComponent)
debug()
```

### `change`

Change the input of the component. This calls `detectChanges` after the props
are updated.

```typescript
const {change} = await render(Counter, {
componentProperties: {count: 4, name: 'Sarah'},
})

expect(screen.getByTestId('count-value').textContent).toBe('4')
expect(screen.getByTestId('name-value').textContent).toBe('Sarah')

change({count: 7})

// count updated to 7
expect(screen.getByTestId('count-value').textContent).toBe('7')
// name keeps the same value
expect(screen.getByTestId('name-value').textContent).toBe('Sarah')
```

### `rerender`

Create and render a new instance of the component. Input properties that are not
Expand All @@ -422,7 +401,7 @@ const {rerender} = await render(Counter, {
expect(screen.getByTestId('count-value').textContent).toBe('4')
expect(screen.getByTestId('name-value').textContent).toBe('Sarah')

await rerender({count: 7})
await rerender({componentProperties: {count: 7}})

// count updated to 7
expect(screen.getByTestId('count-value').textContent).toBe('7')
Expand Down