mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
AAE-47577 Form Spinner persists outside of Automate Form (#12005)
This commit is contained in:
+14
@@ -96,4 +96,18 @@ describe('FormCloudSpinnerService', () => {
|
||||
const spinners = await rootLoader.getAllHarnesses(MatProgressSpinnerHarness);
|
||||
expect(spinners.length).toBe(1);
|
||||
});
|
||||
|
||||
it('should dispose the spinner overlay when the host destroyRef fires without a hide event', async () => {
|
||||
spinnerService.initSpinnerHandling(destroyRef);
|
||||
formService.toggleFormSpinner.next(showSpinnerEvent);
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(await rootLoader.hasHarness(MatProgressSpinnerHarness)).toBeTrue();
|
||||
|
||||
fixture.destroy();
|
||||
|
||||
const overlayContainer = document.querySelector('.cdk-overlay-container');
|
||||
expect(overlayContainer?.querySelector('.cdk-overlay-pane')).toBeNull();
|
||||
expect(overlayContainer?.querySelector('.cdk-overlay-backdrop')).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
+8
-2
@@ -40,9 +40,15 @@ export class FormCloudSpinnerService {
|
||||
const componentRef = this.overlayRef.attach(userProfilePortal);
|
||||
componentRef.instance.message = event.payload.message;
|
||||
} else if (event?.payload.showSpinner === false) {
|
||||
this.overlayRef?.detach();
|
||||
this.overlayRef = null;
|
||||
this.disposeOverlay();
|
||||
}
|
||||
});
|
||||
|
||||
destroyRef.onDestroy(() => this.disposeOverlay());
|
||||
}
|
||||
|
||||
private disposeOverlay(): void {
|
||||
this.overlayRef?.dispose();
|
||||
this.overlayRef = null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user