Skip to content

Commit

Permalink
docs(angular-testing-library): update rerender api (#1249)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicoss54 authored May 1, 2023
1 parent cec02ce commit fafc7fd
Showing 1 changed file with 1 addition and 22 deletions.
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

0 comments on commit fafc7fd

Please sign in to comment.