SI-1036 exclusion for window.load for test implemented
Signed-off-by: Dimitrios Chalepakis <dimitrios.chalepakis@pta.de>
diff --git a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.sandbox.spec.ts b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.sandbox.spec.ts
index ac566ad..53fc118 100644
--- a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.sandbox.spec.ts
+++ b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.sandbox.spec.ts
@@ -40,6 +40,7 @@
let router: Router;
let modalService: NgbModal;
let dispatchSpy: any;
+ let configService. any;
beforeEach(async(() => {
appState = { dispatch: () => {}, pipe: () => of(true), select: () => of(true), userDefinedProperties: { controlId: '' } } as any;
@@ -52,7 +53,8 @@
branch.id = '00';
branch.name = 'OS';
branch.description = 'ohne Sparte';
- service = new GridFailureDetailsSandbox(appState, actionSubject, router, utilService, modalService);
+ configService = { getEnv: () => 'test' } as any;
+ service = new GridFailureDetailsSandbox(appState, actionSubject, router, utilService, modalService, configService);
service.currentFormState = INITIAL_STATE;
service.gridFailureBranches$ = of([branch]);
service.gridFailureDetailsFormState$ = of((INITIAL_STATE.value.branchId = '00' as any));
diff --git a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.sandbox.ts b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.sandbox.ts
index 3467207..f314ac7 100644
--- a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.sandbox.ts
+++ b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.sandbox.ts
@@ -1,3 +1,4 @@
+import { ConfigService } from '@grid-failure-information-app/app/app-config.service';
/********************************************************************************
* Copyright (c) 2020 Contributors to the Eclipse Foundation
*
@@ -50,6 +51,7 @@
import { combineLatest, Observable } from 'rxjs';
import { debounceTime, distinctUntilChanged, map, skipWhile, take, takeUntil, tap } from 'rxjs/operators';
import { FailureStation } from '@grid-failure-information-app/shared/models';
+import { environment } from '@grid-failure-information-app/environments/environment';
@Injectable()
export class GridFailureDetailsSandbox extends BaseFormSandbox<models.GridFailure> {
@@ -141,7 +143,8 @@
protected actionsSubject: ActionsSubject,
private _router: Router,
private _utilService: UtilService,
- private _modalService: NgbModal
+ private _modalService: NgbModal,
+ private _configService: ConfigService
) {
super(appState$);
}
@@ -310,7 +313,9 @@
);
this.actionsSubject.pipe(ofType(gridFailureActions.saveGridFailureSuccess), take(1), takeUntil(this._endSubscriptions$)).subscribe(() => {
this.setFormStatePristine();
- window.location.reload();
+ if (this._configService.getEnv('env') !== 'test') {
+ window.location.reload();
+ }
});
} else {
// Checks if only coordinates are invalid