Skip to content

Commit

Permalink
feat: remove detectChanges in favor of detectChangesOnRender (#341)
Browse files Browse the repository at this point in the history
BREAKING CHANGE:

The config property detectChanges is renamed to detectChangesOnRender.

BEFORE:

```ts
const component = await render(AppComponent, {
  detectChanges: false
});
```

AFTER:

```ts
const component = await render(AppComponent, {
  detectChangesOnRender: false
});
```
  • Loading branch information
timdeschryver authored Dec 10, 2022
1 parent 40342b6 commit c229778
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 21 deletions.
16 changes: 0 additions & 16 deletions projects/testing-library/src/lib/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,22 +89,6 @@ export interface RenderComponentOptions<ComponentType, Q extends Queries = typeo
* })
*/
autoDetectChanges?: boolean;
/**
* @description
* Will call detectChanges when the component is compiled
*
* @default
* true
*
* @example
* const component = await render(AppComponent, {
* detectChanges: false
* })
*
* @deprecated
* Use `detectChangesOnRender` instead
*/
detectChanges?: boolean;
/**
* @description
* Invokes `detectChanges` after the component is rendered
Expand Down
6 changes: 1 addition & 5 deletions projects/testing-library/src/lib/testing-library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ export async function render<SutType, WrapperType = SutType>(
): Promise<RenderResult<SutType>> {
const { dom: domConfig, ...globalConfig } = getConfig();
const {
detectChanges: detectChangesDeprecated = true,
detectChangesOnRender: detectChangesOnRenderInput,
detectChangesOnRender = true,
autoDetectChanges = true,
declarations = [],
imports = [],
Expand All @@ -67,9 +66,6 @@ export async function render<SutType, WrapperType = SutType>(
defaultImports = [],
} = { ...globalConfig, ...renderOptions };

const detectChangesOnRender =
detectChangesOnRenderInput === undefined ? detectChangesDeprecated : detectChangesOnRenderInput;

dtlConfigure(domConfig);

TestBed.configureTestingModule({
Expand Down

0 comments on commit c229778

Please sign in to comment.