Skip to content

Commit 4173951

Browse files
committed
feat: remove change and changeInput in favor of rerender
BREAKING CHANGE: Use erender instead of change. Use erender instead of changechangeInput For more info see #365
1 parent 71c623f commit 4173951

File tree

2 files changed

+0
-44
lines changed

2 files changed

+0
-44
lines changed

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

-16
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,6 @@ export interface RenderResult<ComponentType, WrapperType = ComponentType> extend
6363
'componentProperties' | 'componentInputs' | 'componentOutputs' | 'detectChangesOnRender'
6464
>,
6565
) => Promise<void>;
66-
/**
67-
* @deprecated
68-
* Use rerender instead. For more info see {@link https://github.com/testing-library/angular-testing-library/issues/365 GitHub Issue}
69-
*
70-
* @description
71-
* Keeps the current fixture intact and invokes ngOnChanges with the updated properties.
72-
*/
73-
change: (changedProperties: Partial<ComponentType>) => void;
74-
/**
75-
* @deprecated
76-
* Use rerender instead. For more info see {@link https://github.com/testing-library/angular-testing-library/issues/365 GitHub Issue}
77-
*
78-
* @description
79-
* Keeps the current fixture intact, update the @Input properties and invoke ngOnChanges with the updated properties.
80-
*/
81-
changeInput: (changedInputProperties: Partial<ComponentType>) => void;
8266
}
8367

8468
export interface RenderComponentOptions<ComponentType, Q extends Queries = typeof queries> {

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

-28
Original file line numberDiff line numberDiff line change
@@ -162,32 +162,6 @@ export async function render<SutType, WrapperType = SutType>(
162162
}
163163
};
164164

165-
const changeInput = (changedInputProperties: Partial<SutType>) => {
166-
if (Object.keys(changedInputProperties).length === 0) {
167-
return;
168-
}
169-
170-
setComponentInputs(fixture, changedInputProperties);
171-
172-
fixture.detectChanges();
173-
};
174-
175-
const change = (changedProperties: Partial<SutType>) => {
176-
if (Object.keys(changedProperties).length === 0) {
177-
return;
178-
}
179-
180-
const changes = getChangesObj(fixture.componentInstance as Record<string, any>, changedProperties);
181-
182-
setComponentProperties(fixture, changedProperties);
183-
184-
if (hasOnChangesHook(fixture.componentInstance)) {
185-
fixture.componentInstance.ngOnChanges(changes);
186-
}
187-
188-
fixture.componentRef.injector.get(ChangeDetectorRef).detectChanges();
189-
};
190-
191165
const navigate = async (elementOrPath: Element | string, basePath = ''): Promise<boolean> => {
192166
const href = typeof elementOrPath === 'string' ? elementOrPath : elementOrPath.getAttribute('href');
193167
const [path, params] = (basePath + href).split('?');
@@ -234,8 +208,6 @@ export async function render<SutType, WrapperType = SutType>(
234208
detectChanges: () => detectChanges(),
235209
navigate,
236210
rerender,
237-
change,
238-
changeInput,
239211
// @ts-ignore: fixture assigned
240212
debugElement: fixture.debugElement,
241213
// @ts-ignore: fixture assigned

0 commit comments

Comments
 (0)