Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.

Commit 972547b

Browse files
committed
chore: fix failing unit tests
1 parent fd0185e commit 972547b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/app/modules/angular-slickgrid/extensions/__tests__/slickRowDetailView.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,9 @@ describe('SlickRowDetailView', () => {
284284
const onBeforeRowSpy = jest.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onBeforeRowDetailToggle');
285285
const onRowOutViewSpy = jest.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onRowOutOfViewportRange');
286286
const onRowBackViewSpy = jest.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onRowBackToViewportRange');
287+
const appendSpy = jest
288+
.spyOn(angularUtilServiceStub, 'createAngularComponentAppendToDom')
289+
.mockReturnValue({ componentRef: { instance: jest.fn() } } as any);
287290

288291
plugin.init(gridStub);
289292
plugin.onAfterRowDetailToggle = new SlickEvent();
@@ -295,6 +298,7 @@ describe('SlickRowDetailView', () => {
295298
// { notify: expect.anything(), subscribe: expect.anything(), unsubscribe: expect.anything(), },
296299
// expect.anything()
297300
// );
301+
expect(appendSpy).toHaveBeenCalled();
298302
expect(onAsyncRespSpy).not.toHaveBeenCalled();
299303
expect(onAsyncEndSpy).not.toHaveBeenCalled();
300304
expect(onAfterRowSpy).toHaveBeenCalledWith(expect.anything(), { item: columnsMock[0], expandedRows: [0], grid: gridStub });
@@ -406,7 +410,7 @@ describe('SlickRowDetailView', () => {
406410
const handlerSpy = jest.spyOn(plugin.eventHandler, 'subscribe');
407411
const appendSpy = jest
408412
.spyOn(angularUtilServiceStub, 'createAngularComponentAppendToDom')
409-
.mockReturnValue({ componentRef: { instance: jest.fn() } } as any);
413+
.mockReturnValue({ componentRef: { instance: jest.fn(), destroy: jest.fn() } } as any);
410414

411415
plugin.init(gridStub);
412416
plugin.onBeforeRowDetailToggle = new SlickEvent();

src/app/modules/angular-slickgrid/extensions/slickRowDetailView.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,9 @@ export class SlickRowDetailView extends UniversalSlickRowDetailView {
318318
const compRef = expandedView?.componentRef;
319319
if (compRef) {
320320
this.appRef.detachView(compRef.hostView);
321-
compRef?.destroy();
321+
if (compRef?.destroy) {
322+
compRef.destroy();
323+
}
322324
return expandedView;
323325
}
324326
}

0 commit comments

Comments
 (0)