From 533b6ee48b1b8db707d38daebe8a16db7b3ef989 Mon Sep 17 00:00:00 2001 From: hudson-newey Date: Wed, 11 Dec 2024 11:33:44 +1000 Subject: [PATCH] Fix testing map loading state --- src/app/components/shared/map/map.component.html | 4 ++-- src/app/components/shared/map/map.component.spec.ts | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app/components/shared/map/map.component.html b/src/app/components/shared/map/map.component.html index d93016bc6..8955dab34 100644 --- a/src/app/components/shared/map/map.component.html +++ b/src/app/components/shared/map/map.component.html @@ -24,10 +24,10 @@

Please ensure your ad-block is not blocking Google Maps

+ } @else if (googleMapsLoaded === null) { + } @else if (!hasMarkers) {

No locations specified

- } @else { - } } diff --git a/src/app/components/shared/map/map.component.spec.ts b/src/app/components/shared/map/map.component.spec.ts index 2c179ce7b..95bcb5fff 100644 --- a/src/app/components/shared/map/map.component.spec.ts +++ b/src/app/components/shared/map/map.component.spec.ts @@ -58,12 +58,14 @@ describe("MapComponent", () => { /** Causes all pending 'loadAsync' promises to resolve */ function triggerLoadSuccess(): void { mapsServiceSpy.mapsState = GoogleMapsState.Loaded; + spectator.component["googleMapsLoaded"] = true; spectator.detectChanges(); } /** Causes all pending 'loadAsync' promises to reject */ function triggerLoadFailure(): void { mapsServiceSpy.mapsState = GoogleMapsState.Failed; + spectator.component["googleMapsLoaded"] = false; spectator.detectChanges(); }