diff --git a/application/frontend/src/app/core/containers/travel-simulator/travel-simulator.component.spec.ts b/application/frontend/src/app/core/containers/travel-simulator/travel-simulator.component.spec.ts index 765ac9c2..8e20f729 100644 --- a/application/frontend/src/app/core/containers/travel-simulator/travel-simulator.component.spec.ts +++ b/application/frontend/src/app/core/containers/travel-simulator/travel-simulator.component.spec.ts @@ -22,6 +22,8 @@ import ShipmentModelSelectors from '../../selectors/shipment-model.selectors'; import TravelSimulatorSelectors from '../../selectors/travel-simulator.selectors'; import { MaterialModule } from 'src/app/material'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { MapService } from '../../services'; +import { MockMapService } from 'src/test/service-mocks'; describe('TravelSimulatorComponent', () => { let component: TravelSimulatorComponent; @@ -32,6 +34,7 @@ describe('TravelSimulatorComponent', () => { imports: [MaterialModule, NoopAnimationsModule], declarations: [TravelSimulatorComponent], providers: [ + { provide: MapService, useValue: MockMapService }, provideMockStore({ selectors: [ { selector: ShipmentModelSelectors.selectGlobalStartTime, value: 0 }, diff --git a/application/frontend/src/app/core/containers/travel-simulator/travel-simulator.component.ts b/application/frontend/src/app/core/containers/travel-simulator/travel-simulator.component.ts index 5c15370b..cd85a64c 100644 --- a/application/frontend/src/app/core/containers/travel-simulator/travel-simulator.component.ts +++ b/application/frontend/src/app/core/containers/travel-simulator/travel-simulator.component.ts @@ -31,6 +31,7 @@ import { setActive, setTime } from '../../actions/travel-simulator.actions'; import TravelSimulatorSelectors from '../../selectors/travel-simulator.selectors'; import { MatSlideToggleChange } from '@angular/material/slide-toggle'; import { formatSecondsDate } from 'src/app/util/time-translation'; +import { MapService } from '../../services'; @Component({ selector: 'app-travel-simulator', @@ -58,7 +59,11 @@ export class TravelSimulatorComponent implements OnInit, OnDestroy { formatSecondsDate = formatSecondsDate; - constructor(private store: Store, private detectorRef: ChangeDetectorRef) {} + constructor( + private store: Store, + private detectorRef: ChangeDetectorRef, + private map: MapService + ) {} ngOnInit(): void { this.end$ = this.store @@ -102,7 +107,9 @@ export class TravelSimulatorComponent implements OnInit, OnDestroy { onToggleActive(event: MatSlideToggleChange): void { this.store.dispatch(setActive({ active: event.checked })); - if (!event.checked) { + if (event.checked) { + this.map.zoomToHome(); + } else { this.onEndAnimate(); } }