From 5ee9bc7be356ea9defc0685c8d454c9c6507b490 Mon Sep 17 00:00:00 2001 From: Nicolas Frizzarin Date: Fri, 28 Apr 2023 10:31:40 +0200 Subject: [PATCH 1/2] docs(angular-testing-library): update rerender api --- docs/angular-testing-library/api.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/angular-testing-library/api.mdx b/docs/angular-testing-library/api.mdx index 9d328722d..1f10d523f 100644 --- a/docs/angular-testing-library/api.mdx +++ b/docs/angular-testing-library/api.mdx @@ -388,7 +388,7 @@ const {debug} = await render(AppComponent) debug() ``` -### `change` +### `change` Deprecated, use rerender instead. Change the input of the component. This calls `detectChanges` after the props are updated. @@ -422,7 +422,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') From 868154629626b55c7a4492284a8debabb8c7ef90 Mon Sep 17 00:00:00 2001 From: Nicolas Frizzarin Date: Mon, 1 May 2023 10:31:51 +0200 Subject: [PATCH 2/2] docs(angular-testing-library): remove deprecated `change` method --- docs/angular-testing-library/api.mdx | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/docs/angular-testing-library/api.mdx b/docs/angular-testing-library/api.mdx index 1f10d523f..06229c656 100644 --- a/docs/angular-testing-library/api.mdx +++ b/docs/angular-testing-library/api.mdx @@ -388,27 +388,6 @@ const {debug} = await render(AppComponent) debug() ``` -### `change` Deprecated, use rerender instead. - -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