Skip to content

Commit 40342b6

Browse files
committed
Merge branch 'main' into beta
2 parents 6e31db5 + 63c27e2 commit 40342b6

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

projects/testing-library/src/lib/models.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,25 @@ export interface RenderComponentOptions<ComponentType, Q extends Queries = typeo
100100
* const component = await render(AppComponent, {
101101
* detectChanges: false
102102
* })
103+
*
104+
* @deprecated
105+
* Use `detectChangesOnRender` instead
103106
*/
104107
detectChanges?: boolean;
108+
/**
109+
* @description
110+
* Invokes `detectChanges` after the component is rendered
111+
*
112+
* @default
113+
* true
114+
*
115+
* @example
116+
* const component = await render(AppComponent, {
117+
* detectChangesOnRender: false
118+
* })
119+
*/
120+
detectChangesOnRender?: boolean;
121+
105122
/**
106123
* @description
107124
* A collection of components, directives and pipes needed to render the component, for example, nested components of the component.

projects/testing-library/src/lib/testing-library.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ export async function render<SutType, WrapperType = SutType>(
4646
): Promise<RenderResult<SutType>> {
4747
const { dom: domConfig, ...globalConfig } = getConfig();
4848
const {
49-
detectChanges: detectChangesOnRender = true,
49+
detectChanges: detectChangesDeprecated = true,
50+
detectChangesOnRender: detectChangesOnRenderInput,
5051
autoDetectChanges = true,
5152
declarations = [],
5253
imports = [],
@@ -66,6 +67,9 @@ export async function render<SutType, WrapperType = SutType>(
6667
defaultImports = [],
6768
} = { ...globalConfig, ...renderOptions };
6869

70+
const detectChangesOnRender =
71+
detectChangesOnRenderInput === undefined ? detectChangesDeprecated : detectChangesOnRenderInput;
72+
6973
dtlConfigure(domConfig);
7074

7175
TestBed.configureTestingModule({

0 commit comments

Comments
 (0)