From d4a0cfcfdf05c43da1564436ac1457ba1ab018c3 Mon Sep 17 00:00:00 2001 From: Harlan Wilton Date: Thu, 19 Mar 2026 23:21:21 +1100 Subject: [PATCH 1/8] feat: add `ScriptGoogleMapsGeoJson` component (closes #655) --- .../GoogleMaps/ScriptGoogleMapsGeoJson.vue | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 src/runtime/components/GoogleMaps/ScriptGoogleMapsGeoJson.vue diff --git a/src/runtime/components/GoogleMaps/ScriptGoogleMapsGeoJson.vue b/src/runtime/components/GoogleMaps/ScriptGoogleMapsGeoJson.vue new file mode 100644 index 00000000..ebfaf77c --- /dev/null +++ b/src/runtime/components/GoogleMaps/ScriptGoogleMapsGeoJson.vue @@ -0,0 +1,86 @@ + + + From 1715e789287b41565d1827bf847ccf204dd9314a Mon Sep 17 00:00:00 2001 From: Harlan Wilton Date: Thu, 19 Mar 2026 23:30:16 +1100 Subject: [PATCH 2/8] test: add tests for ScriptGoogleMapsGeoJson component - Add Data layer mock (createMockDataLayer) with GeoJSON methods - Add DATA_MOUSE_EVENTS and DATA_FEATURE_EVENTS constants - Add simulateGeoJsonLifecycle helper and geoJson test options - Add unit tests covering creation, loading, events, cleanup, lifecycle - Add GeoJson to playground sfcs page --- .../pages/third-parties/google-maps/sfcs.vue | 40 +++++ .../__helpers__/google-maps-test-utils.ts | 41 +++++ test/unit/__mocks__/google-maps-api.ts | 49 ++++++ test/unit/google-maps-geojson.test.ts | 159 ++++++++++++++++++ 4 files changed, 289 insertions(+) create mode 100644 test/unit/google-maps-geojson.test.ts diff --git a/playground/pages/third-parties/google-maps/sfcs.vue b/playground/pages/third-parties/google-maps/sfcs.vue index cf58f3fb..3fd79955 100644 --- a/playground/pages/third-parties/google-maps/sfcs.vue +++ b/playground/pages/third-parties/google-maps/sfcs.vue @@ -36,6 +36,28 @@ const heatmapLayerData = ref([]) const isCircleShown = ref(false) +const isGeoJsonShown = ref(false) + +const geoJsonData = { + type: 'FeatureCollection', + features: [ + { + type: 'Feature', + geometry: { + type: 'Polygon', + coordinates: [[ + [151.20, -33.87], + [151.25, -33.87], + [151.25, -33.90], + [151.20, -33.90], + [151.20, -33.87], + ]], + }, + properties: { name: 'Sydney CBD' }, + }, + ], +} + const googleMapsRef = useTemplateRef('googleMapsRef') whenever(() => googleMapsRef.value?.googleMaps, (googleMaps) => { @@ -191,6 +213,17 @@ whenever(() => googleMapsRef.value?.googleMaps, (googleMaps) => { }" /> + + + {{ `${isGeoJsonShown ? 'Hide' : 'Show'} geojson` }} + +