diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 6ed4ad7a80..202d02309a 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -168,12 +168,7 @@ const routes: Routes = [ ] @NgModule({ - imports: [ - RouterModule.forRoot(routes, { - relativeLinkResolution: 'legacy', - anchorScrolling: 'enabled', - }), - ], + imports: [RouterModule.forRoot(routes, { relativeLinkResolution: 'legacy' })], exports: [RouterModule], }) export class AppRoutingModule {} diff --git a/src/app/developer-tools/pages/developer-tools/developer-tools.component.spec.ts b/src/app/developer-tools/pages/developer-tools/developer-tools.component.spec.ts index 52ce3e00aa..f3d4349fe9 100644 --- a/src/app/developer-tools/pages/developer-tools/developer-tools.component.spec.ts +++ b/src/app/developer-tools/pages/developer-tools/developer-tools.component.spec.ts @@ -7,7 +7,7 @@ import { RecordService } from 'src/app/core/record/record.service' import { ChangeDetectorRef } from '@angular/core' import { UserInfoService } from 'src/app/core/user-info/user-info.service' import { of } from 'rxjs' -import { WINDOW_PROVIDERS } from 'src/app/cdk/window' +import { WINDOW, WINDOW_PROVIDERS } from 'src/app/cdk/window' import { DeveloperToolsComponent } from './developer-tools.component' import { PlatformInfoService } from 'src/app/cdk/platform-info' @@ -19,7 +19,7 @@ describe('DeveloperToolsComponent', () => { await TestBed.configureTestingModule({ declarations: [DeveloperToolsComponent], providers: [ - WINDOW_PROVIDERS, + { provide: WINDOW, useValue: {} }, { provide: PlatformInfoService, useValue: { get: () => of({}) }, diff --git a/src/app/developer-tools/pages/developer-tools/developer-tools.component.ts b/src/app/developer-tools/pages/developer-tools/developer-tools.component.ts index 3079dd4992..2809ee7828 100644 --- a/src/app/developer-tools/pages/developer-tools/developer-tools.component.ts +++ b/src/app/developer-tools/pages/developer-tools/developer-tools.component.ts @@ -93,7 +93,9 @@ export class DeveloperToolsComponent implements OnInit, OnDestroy { this.isMobile = platform.columns4 || platform.columns8 }) - this.baseURL = this.window.location.origin + if (this.window?.location) { + this.baseURL = this.window.location.origin + } this.getDeveloperToolsEnableState() .pipe( switchMap((developerToolsEnableState) => { @@ -144,15 +146,17 @@ export class DeveloperToolsComponent implements OnInit, OnDestroy { } private setFocusToTheMainDiv() { - this.window.location.href = '/developer-tools' + '#main' - setTimeout(() => { - this.window.window.scrollTo(0, 0) - this.window.history.replaceState( - {}, - this.window.document.title, - '/developer-tools' - ) - }) + if (this.window?.location) { + this.window.location.href = '/developer-tools' + '#main' + setTimeout(() => { + this.window.window.scrollTo(0, 0) + this.window.history.replaceState( + {}, + this.window.document.title, + '/developer-tools' + ) + }) + } } save() {