From 89d7752bae07c43bbd839ca7af1dc747a184c433 Mon Sep 17 00:00:00 2001 From: Nikos Moysiadis Date: Wed, 22 Nov 2023 09:58:11 +0200 Subject: [PATCH] refactor(google-maps): convert test components to standalone (#28168) --- src/google-maps/README.md | 21 ++++++------------- src/google-maps/google-map/README.md | 18 +++------------- src/google-maps/google-map/google-map.spec.ts | 5 +++-- src/google-maps/map-bicycling-layer/README.md | 3 +++ .../map-bicycling-layer.spec.ts | 5 +++-- src/google-maps/map-circle/README.md | 3 +++ src/google-maps/map-circle/map-circle.spec.ts | 5 +++-- .../map-directions-renderer/README.md | 4 +++- .../map-directions-renderer.spec.ts | 5 +++-- src/google-maps/map-geocoder/README.md | 1 + src/google-maps/map-ground-overlay/README.md | 3 +++ .../map-ground-overlay.spec.ts | 5 +++-- src/google-maps/map-heatmap-layer/README.md | 3 +++ .../map-heatmap-layer.spec.ts | 5 +++-- src/google-maps/map-info-window/README.md | 4 +++- .../map-info-window/map-info-window.spec.ts | 5 +++-- src/google-maps/map-kml-layer/README.md | 3 +++ .../map-kml-layer/map-kml-layer.spec.ts | 5 +++-- .../map-marker-clusterer/README.md | 3 +++ .../map-marker-clusterer.spec.ts | 5 +++-- src/google-maps/map-marker/README.md | 4 +++- src/google-maps/map-marker/map-marker.spec.ts | 5 +++-- src/google-maps/map-polygon/README.md | 3 +++ .../map-polygon/map-polygon.spec.ts | 5 +++-- src/google-maps/map-polyline/README.md | 3 +++ .../map-polyline/map-polyline.spec.ts | 5 +++-- src/google-maps/map-rectangle/README.md | 3 +++ .../map-rectangle/map-rectangle.spec.ts | 5 +++-- src/google-maps/map-traffic-layer/README.md | 3 +++ .../map-traffic-layer.spec.ts | 5 +++-- src/google-maps/map-transit-layer/README.md | 3 +++ .../map-transit-layer.spec.ts | 5 +++-- 32 files changed, 97 insertions(+), 63 deletions(-) diff --git a/src/google-maps/README.md b/src/google-maps/README.md index 0115a5e1f078..78f4246dac30 100644 --- a/src/google-maps/README.md +++ b/src/google-maps/README.md @@ -21,25 +21,13 @@ method to make sure that the component doesn't load until after the API has load // google-maps-demo.module.ts import { NgModule } from '@angular/core'; -import { GoogleMap } from '@angular/google-maps'; -import { CommonModule } from '@angular/common'; -import { HttpClientModule, HttpClientJsonpModule } from '@angular/common/http'; +import { provideHttpClient, withJsonpSupport } from '@angular/common/http'; import { GoogleMapsDemoComponent } from './google-maps-demo.component'; @NgModule({ - declarations: [ - GoogleMapsDemoComponent, - ], - imports: [ - CommonModule, - GoogleMap, - HttpClientModule, - HttpClientJsonpModule, - ], - exports: [ - GoogleMapsDemoComponent, - ], + imports: [GoogleMapsDemoComponent], + providers: [provideHttpClient(withJsonpSupport())] }) export class GoogleMapsDemoModule {} @@ -48,12 +36,15 @@ export class GoogleMapsDemoModule {} import { Component } from '@angular/core'; import { HttpClient } from '@angular/common/http'; +import { GoogleMap } from '@angular/google-maps'; import { Observable, of } from 'rxjs'; import { catchError, map } from 'rxjs/operators'; @Component({ selector: 'google-maps-demo', templateUrl: './google-maps-demo.component.html', + standalone: true, + imports: [GoogleMap] }) export class GoogleMapsDemoComponent { apiLoaded: Observable; diff --git a/src/google-maps/google-map/README.md b/src/google-maps/google-map/README.md index d04e6083e832..9800205c837f 100644 --- a/src/google-maps/google-map/README.md +++ b/src/google-maps/google-map/README.md @@ -5,27 +5,15 @@ The `GoogleMap` component wraps the [`google.maps.Map` class](https://developers ## Example ```typescript -// google-maps-demo.module.ts - -import {NgModule} from '@angular/core'; -import {GoogleMap} from '@angular/google-maps'; - -import {GoogleMapDemo} from './google-map-demo'; - -@NgModule({ - imports: [GoogleMap], - declarations: [GoogleMapDemo], -}) -export class GoogleMapDemoModule { -} - - // google-maps-demo.component.ts import {Component} from '@angular/core'; +import {GoogleMap} from '@angular/google-maps'; @Component({ selector: 'google-map-demo', templateUrl: 'google-map-demo.html', + standalone: true, + imports: [GoogleMap], }) export class GoogleMapDemo { diff --git a/src/google-maps/google-map/google-map.spec.ts b/src/google-maps/google-map/google-map.spec.ts index 7d2327d7d81a..753009c9d3a1 100644 --- a/src/google-maps/google-map/google-map.spec.ts +++ b/src/google-maps/google-map/google-map.spec.ts @@ -25,8 +25,7 @@ describe('GoogleMap', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [GoogleMap], - declarations: [TestApp], + imports: [TestApp], }); })); @@ -409,6 +408,8 @@ describe('GoogleMap', () => { (mapRightclick)="handleRightclick($event)" (mapInitialized)="mapInitializedSpy($event)"> `, + standalone: true, + imports: [GoogleMap], }) class TestApp { @ViewChild(GoogleMap) map: GoogleMap; diff --git a/src/google-maps/map-bicycling-layer/README.md b/src/google-maps/map-bicycling-layer/README.md index dc562836b9da..76715806cc8f 100644 --- a/src/google-maps/map-bicycling-layer/README.md +++ b/src/google-maps/map-bicycling-layer/README.md @@ -7,10 +7,13 @@ The `MapBicyclingLayer` component wraps the [`google.maps.BicyclingLayer` class] ```typescript // google-maps-demo.component.ts import {Component} from '@angular/core'; +import {GoogleMap, MapBicyclingLayer} from '@angular/google-maps'; @Component({ selector: 'google-map-demo', templateUrl: 'google-map-demo.html', + standalone: true, + imports: [GoogleMap, MapBicyclingLayer], }) export class GoogleMapDemo { center: google.maps.LatLngLiteral = {lat: 24, lng: 12}; diff --git a/src/google-maps/map-bicycling-layer/map-bicycling-layer.spec.ts b/src/google-maps/map-bicycling-layer/map-bicycling-layer.spec.ts index 27a79887ee7a..be803896e732 100644 --- a/src/google-maps/map-bicycling-layer/map-bicycling-layer.spec.ts +++ b/src/google-maps/map-bicycling-layer/map-bicycling-layer.spec.ts @@ -16,8 +16,7 @@ describe('MapBicyclingLayer', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [GoogleMap, MapBicyclingLayer], - declarations: [TestApp], + imports: [TestApp], }); })); @@ -50,5 +49,7 @@ describe('MapBicyclingLayer', () => { template: ` `, + standalone: true, + imports: [GoogleMap, MapBicyclingLayer], }) class TestApp {} diff --git a/src/google-maps/map-circle/README.md b/src/google-maps/map-circle/README.md index d7783d20d0d4..3fb1e8df36ec 100644 --- a/src/google-maps/map-circle/README.md +++ b/src/google-maps/map-circle/README.md @@ -7,10 +7,13 @@ The `MapCircle` component wraps the [`google.maps.Circle` class](https://develop ```typescript // google-maps-demo.component.ts import {Component} from '@angular/core'; +import {GoogleMap, MapCircle} from '@angular/google-maps'; @Component({ selector: 'google-map-demo', templateUrl: 'google-map-demo.html', + standalone: true, + imports: [GoogleMap, MapCircle], }) export class GoogleMapDemo { center: google.maps.LatLngLiteral = {lat: 24, lng: 12}; diff --git a/src/google-maps/map-circle/map-circle.spec.ts b/src/google-maps/map-circle/map-circle.spec.ts index 1e54bbd96189..7e9b07fb3aad 100644 --- a/src/google-maps/map-circle/map-circle.spec.ts +++ b/src/google-maps/map-circle/map-circle.spec.ts @@ -28,8 +28,7 @@ describe('MapCircle', () => { strokeOpacity: 0.8, }; TestBed.configureTestingModule({ - imports: [GoogleMap, MapCircle], - declarations: [TestApp], + imports: [TestApp], }); })); @@ -165,6 +164,8 @@ describe('MapCircle', () => { (circleRightclick)="handleRightclick()"> `, + standalone: true, + imports: [GoogleMap, MapCircle], }) class TestApp { @ViewChild(MapCircle) circle: MapCircle; diff --git a/src/google-maps/map-directions-renderer/README.md b/src/google-maps/map-directions-renderer/README.md index f0e705d4dd51..19adffa5ecf3 100644 --- a/src/google-maps/map-directions-renderer/README.md +++ b/src/google-maps/map-directions-renderer/README.md @@ -21,12 +21,14 @@ Using the `MapDirectionsService` requires the Directions API to be enabled in Go ```typescript // google-maps-demo.component.ts -import {MapDirectionsService} from '@angular/google-maps'; import {Component} from '@angular/core'; +import {GoogleMap, MapDirectionsRenderer, MapDirectionsService} from '@angular/google-maps'; @Component({ selector: 'google-map-demo', templateUrl: 'google-map-demo.html', + standalone: true, + imports: [GoogleMap, MapDirectionsRenderer], }) export class GoogleMapDemo { center: google.maps.LatLngLiteral = {lat: 24, lng: 12}; diff --git a/src/google-maps/map-directions-renderer/map-directions-renderer.spec.ts b/src/google-maps/map-directions-renderer/map-directions-renderer.spec.ts index 21c7e77da0ed..f5754b359deb 100644 --- a/src/google-maps/map-directions-renderer/map-directions-renderer.spec.ts +++ b/src/google-maps/map-directions-renderer/map-directions-renderer.spec.ts @@ -20,8 +20,7 @@ describe('MapDirectionsRenderer', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [GoogleMap, MapDirectionsRenderer], - declarations: [TestApp], + imports: [TestApp], }); })); @@ -132,6 +131,8 @@ describe('MapDirectionsRenderer', () => { (directionsChanged)="handleDirectionsChanged()"> `, + standalone: true, + imports: [GoogleMap, MapDirectionsRenderer], }) class TestApp { @ViewChild(MapDirectionsRenderer) directionsRenderer: MapDirectionsRenderer; diff --git a/src/google-maps/map-geocoder/README.md b/src/google-maps/map-geocoder/README.md index f6b8257fc9e4..d36f2ebb99d9 100644 --- a/src/google-maps/map-geocoder/README.md +++ b/src/google-maps/map-geocoder/README.md @@ -30,6 +30,7 @@ import {MapGeocoder} from '@angular/google-maps'; @Component({ selector: 'google-map-demo', templateUrl: 'google-map-demo.html', + standalone: true, }) export class GoogleMapDemo { constructor(geocoder: MapGeocoder) { diff --git a/src/google-maps/map-ground-overlay/README.md b/src/google-maps/map-ground-overlay/README.md index 07488d9a171b..12ec7c0dd630 100644 --- a/src/google-maps/map-ground-overlay/README.md +++ b/src/google-maps/map-ground-overlay/README.md @@ -7,10 +7,13 @@ The `MapGroundOverlay` component wraps the [`google.maps.GroundOverlay` class](h ```typescript // google-maps-demo.component.ts import {Component} from '@angular/core'; +import {GoogleMap, MapGroundOverlay} from '@angular/google-maps'; @Component({ selector: 'google-map-demo', templateUrl: 'google-map-demo.html', + standalone: true, + imports: [GoogleMap, MapGroundOverlay], }) export class GoogleMapDemo { center: google.maps.LatLngLiteral = {lat: 24, lng: 12}; diff --git a/src/google-maps/map-ground-overlay/map-ground-overlay.spec.ts b/src/google-maps/map-ground-overlay/map-ground-overlay.spec.ts index c7c6b1c14ac5..e7694d64b51b 100644 --- a/src/google-maps/map-ground-overlay/map-ground-overlay.spec.ts +++ b/src/google-maps/map-ground-overlay/map-ground-overlay.spec.ts @@ -22,8 +22,7 @@ describe('MapGroundOverlay', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [GoogleMap, MapGroundOverlay], - declarations: [TestApp], + imports: [TestApp], }); })); @@ -163,6 +162,8 @@ describe('MapGroundOverlay', () => { (mapClick)="handleClick()"> `, + standalone: true, + imports: [GoogleMap, MapGroundOverlay], }) class TestApp { @ViewChild(MapGroundOverlay) groundOverlay: MapGroundOverlay; diff --git a/src/google-maps/map-heatmap-layer/README.md b/src/google-maps/map-heatmap-layer/README.md index cca046f0560a..466861c0e17b 100644 --- a/src/google-maps/map-heatmap-layer/README.md +++ b/src/google-maps/map-heatmap-layer/README.md @@ -28,10 +28,13 @@ More information: https://developers.google.com/maps/documentation/javascript/he ```typescript // google-map-demo.component.ts import {Component} from '@angular/core'; +import {GoogleMap, MapHeatmapLayer} from '@angular/google-maps'; @Component({ selector: 'google-map-demo', templateUrl: 'google-map-demo.html', + standalone: true, + imports: [GoogleMap, MapHeatmapLayer], }) export class GoogleMapDemo { center = {lat: 37.774546, lng: -122.433523}; diff --git a/src/google-maps/map-heatmap-layer/map-heatmap-layer.spec.ts b/src/google-maps/map-heatmap-layer/map-heatmap-layer.spec.ts index d336bcb99c60..22bc56dff659 100644 --- a/src/google-maps/map-heatmap-layer/map-heatmap-layer.spec.ts +++ b/src/google-maps/map-heatmap-layer/map-heatmap-layer.spec.ts @@ -19,8 +19,7 @@ describe('MapHeatmapLayer', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [GoogleMap, MapHeatmapLayer], - declarations: [TestApp], + imports: [TestApp], }); })); @@ -159,6 +158,8 @@ describe('MapHeatmapLayer', () => { `, + standalone: true, + imports: [GoogleMap, MapHeatmapLayer], }) class TestApp { @ViewChild(MapHeatmapLayer) heatmap: MapHeatmapLayer; diff --git a/src/google-maps/map-info-window/README.md b/src/google-maps/map-info-window/README.md index 046553258ab2..3f189100e407 100644 --- a/src/google-maps/map-info-window/README.md +++ b/src/google-maps/map-info-window/README.md @@ -9,11 +9,13 @@ To display the `MapInfoWindow`, it must be a child of a `GoogleMap` component, a ```typescript // google-maps-demo.component.ts import {Component, ViewChild} from '@angular/core'; -import {MapInfoWindow, MapMarker} from '@angular/google-maps'; +import {GoogleMap, MapInfoWindow, MapMarker} from '@angular/google-maps'; @Component({ selector: 'google-map-demo', templateUrl: 'google-map-demo.html', + standalone: true, + imports: [GoogleMap, MapInfoWindow, MapMarker], }) export class GoogleMapDemo { @ViewChild(MapInfoWindow) infoWindow: MapInfoWindow; diff --git a/src/google-maps/map-info-window/map-info-window.spec.ts b/src/google-maps/map-info-window/map-info-window.spec.ts index bed4a5fe2ab3..7d9bb3389d6f 100644 --- a/src/google-maps/map-info-window/map-info-window.spec.ts +++ b/src/google-maps/map-info-window/map-info-window.spec.ts @@ -18,8 +18,7 @@ describe('MapInfoWindow', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [GoogleMap, MapInfoWindow], - declarations: [TestApp], + imports: [TestApp], }); })); @@ -261,6 +260,8 @@ describe('MapInfoWindow', () => { test content `, + standalone: true, + imports: [GoogleMap, MapInfoWindow], }) class TestApp { @ViewChild(MapInfoWindow) infoWindow: MapInfoWindow; diff --git a/src/google-maps/map-kml-layer/README.md b/src/google-maps/map-kml-layer/README.md index 96ba65b44119..15ff0dcbd9ad 100644 --- a/src/google-maps/map-kml-layer/README.md +++ b/src/google-maps/map-kml-layer/README.md @@ -7,10 +7,13 @@ The `MapKmlLayer` component wraps the [`google.maps.KmlLayer` class](https://dev ```typescript // google-maps-demo.component.ts import {Component} from '@angular/core'; +import {GoogleMap, MapKmlLayer} from '@angular/google-maps'; @Component({ selector: 'google-map-demo', templateUrl: 'google-map-demo.html', + standalone: true, + imports: [GoogleMap, MapKmlLayer], }) export class GoogleMapDemo { center: google.maps.LatLngLiteral = {lat: 24, lng: 12}; diff --git a/src/google-maps/map-kml-layer/map-kml-layer.spec.ts b/src/google-maps/map-kml-layer/map-kml-layer.spec.ts index 9945673edee3..0d79525a25e1 100644 --- a/src/google-maps/map-kml-layer/map-kml-layer.spec.ts +++ b/src/google-maps/map-kml-layer/map-kml-layer.spec.ts @@ -24,8 +24,7 @@ describe('MapKmlLayer', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [GoogleMap, MapKmlLayer], - declarations: [TestApp], + imports: [TestApp], }); })); @@ -155,6 +154,8 @@ describe('MapKmlLayer', () => { (statusChanged)="handleStatusChange()"> `, + standalone: true, + imports: [GoogleMap, MapKmlLayer], }) class TestApp { @ViewChild(MapKmlLayer) kmlLayer: MapKmlLayer; diff --git a/src/google-maps/map-marker-clusterer/README.md b/src/google-maps/map-marker-clusterer/README.md index 1ca18feb31b4..75521ddee204 100644 --- a/src/google-maps/map-marker-clusterer/README.md +++ b/src/google-maps/map-marker-clusterer/README.md @@ -17,10 +17,13 @@ Additional information can be found by looking at [Marker Clustering](https://de ```typescript // google-map-demo.component.ts import {Component} from '@angular/core'; +import {GoogleMap, MapMarker, MapMarkerClusterer} from '@angular/google-maps'; @Component({ selector: 'google-map-demo', templateUrl: 'google-map-demo.html', + standalone: true, + imports: [GoogleMap, MapMarker, MapMarkerClusterer], }) export class GoogleMapDemo { center: google.maps.LatLngLiteral = {lat: 24, lng: 12}; diff --git a/src/google-maps/map-marker-clusterer/map-marker-clusterer.spec.ts b/src/google-maps/map-marker-clusterer/map-marker-clusterer.spec.ts index d4f6323a201d..67cdd1be79c9 100644 --- a/src/google-maps/map-marker-clusterer/map-marker-clusterer.spec.ts +++ b/src/google-maps/map-marker-clusterer/map-marker-clusterer.spec.ts @@ -30,8 +30,7 @@ describe('MapMarkerClusterer', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [GoogleMap, MapMarker, MapMarkerClusterer], - declarations: [TestApp], + imports: [TestApp], }); })); @@ -336,6 +335,8 @@ describe('MapMarkerClusterer', () => { } `, + standalone: true, + imports: [GoogleMap, MapMarker, MapMarkerClusterer], }) class TestApp { @ViewChild(MapMarkerClusterer) markerClusterer: MapMarkerClusterer; diff --git a/src/google-maps/map-marker/README.md b/src/google-maps/map-marker/README.md index 2360943b2940..0dbc38334e59 100644 --- a/src/google-maps/map-marker/README.md +++ b/src/google-maps/map-marker/README.md @@ -7,13 +7,15 @@ The `MapMarker` component wraps the [`google.maps.Marker` class](https://develop ```typescript // google-map-demo.component.ts import {Component} from '@angular/core'; +import {GoogleMap, MapMarker} from '@angular/google-maps'; @Component({ selector: 'google-map-demo', templateUrl: 'google-map-demo.html', + standalone: true, + imports: [GoogleMap, MapMarker], }) export class GoogleMapDemo { - center: google.maps.LatLngLiteral = {lat: 24, lng: 12}; zoom = 4; markerOptions: google.maps.MarkerOptions = {draggable: false}; diff --git a/src/google-maps/map-marker/map-marker.spec.ts b/src/google-maps/map-marker/map-marker.spec.ts index b04dd2427799..dca751b47eb8 100644 --- a/src/google-maps/map-marker/map-marker.spec.ts +++ b/src/google-maps/map-marker/map-marker.spec.ts @@ -15,8 +15,7 @@ describe('MapMarker', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [GoogleMap, MapMarker], - declarations: [TestApp], + imports: [TestApp], }); })); @@ -233,6 +232,8 @@ describe('MapMarker', () => { (positionChanged)="handlePositionChanged()"> `, + standalone: true, + imports: [GoogleMap, MapMarker], }) class TestApp { @ViewChild(MapMarker) marker: MapMarker; diff --git a/src/google-maps/map-polygon/README.md b/src/google-maps/map-polygon/README.md index 000f29f9c86c..c229a930da27 100644 --- a/src/google-maps/map-polygon/README.md +++ b/src/google-maps/map-polygon/README.md @@ -7,10 +7,13 @@ The `MapPolygon` component wraps the [`google.maps.Polygon` class](https://devel ```typescript // google-maps-demo.component.ts import {Component} from '@angular/core'; +import {GoogleMap, MapPolygon} from '@angular/google-maps'; @Component({ selector: 'google-map-demo', templateUrl: 'google-map-demo.html', + standalone: true, + imports: [GoogleMap, MapPolygon], }) export class GoogleMapDemo { center: google.maps.LatLngLiteral = {lat: 24, lng: 12}; diff --git a/src/google-maps/map-polygon/map-polygon.spec.ts b/src/google-maps/map-polygon/map-polygon.spec.ts index 2418159e312f..e8c4818cdbca 100644 --- a/src/google-maps/map-polygon/map-polygon.spec.ts +++ b/src/google-maps/map-polygon/map-polygon.spec.ts @@ -25,8 +25,7 @@ describe('MapPolygon', () => { ]; polygonOptions = {paths: polygonPath, strokeColor: 'grey', strokeOpacity: 0.8}; TestBed.configureTestingModule({ - imports: [GoogleMap, MapPolygon], - declarations: [TestApp], + imports: [TestApp], }); })); @@ -154,6 +153,8 @@ describe('MapPolygon', () => { (polygonRightclick)="handleRightclick()"> `, + standalone: true, + imports: [GoogleMap, MapPolygon], }) class TestApp { @ViewChild(MapPolygon) polygon: MapPolygon; diff --git a/src/google-maps/map-polyline/README.md b/src/google-maps/map-polyline/README.md index 0c2c7687d689..0c272a346301 100644 --- a/src/google-maps/map-polyline/README.md +++ b/src/google-maps/map-polyline/README.md @@ -7,10 +7,13 @@ The `MapPolyline` component wraps the [`google.maps.Polyline` class](https://dev ```typescript // google-maps-demo.component.ts import {Component} from '@angular/core'; +import {GoogleMap, MapPolyline} from '@angular/google-maps'; @Component({ selector: 'google-map-demo', templateUrl: 'google-map-demo.html', + standalone: true, + imports: [GoogleMap, MapPolyline], }) export class GoogleMapDemo { center: google.maps.LatLngLiteral = {lat: 24, lng: 12}; diff --git a/src/google-maps/map-polyline/map-polyline.spec.ts b/src/google-maps/map-polyline/map-polyline.spec.ts index bb8d083dc132..c9d76488d872 100644 --- a/src/google-maps/map-polyline/map-polyline.spec.ts +++ b/src/google-maps/map-polyline/map-polyline.spec.ts @@ -29,8 +29,7 @@ describe('MapPolyline', () => { strokeOpacity: 0.8, }; TestBed.configureTestingModule({ - imports: [GoogleMap, MapPolyline], - declarations: [TestApp], + imports: [TestApp], }); })); @@ -155,6 +154,8 @@ describe('MapPolyline', () => { (polylineRightclick)="handleRightclick()"> `, + standalone: true, + imports: [GoogleMap, MapPolyline], }) class TestApp { @ViewChild(MapPolyline) polyline: MapPolyline; diff --git a/src/google-maps/map-rectangle/README.md b/src/google-maps/map-rectangle/README.md index b74e53ef178a..a813d585c401 100644 --- a/src/google-maps/map-rectangle/README.md +++ b/src/google-maps/map-rectangle/README.md @@ -7,10 +7,13 @@ The `MapRectangle` component wraps the [`google.maps.Rectangle` class](https://d ```typescript // google-maps-demo.component.ts import {Component} from '@angular/core'; +import {GoogleMap, MapRectangle} from '@angular/google-maps'; @Component({ selector: 'google-map-demo', templateUrl: 'google-map-demo.html', + standalone: true, + imports: [GoogleMap, MapRectangle], }) export class GoogleMapDemo { center: google.maps.LatLngLiteral = {lat: 24, lng: 12}; diff --git a/src/google-maps/map-rectangle/map-rectangle.spec.ts b/src/google-maps/map-rectangle/map-rectangle.spec.ts index 6dfc8b28e592..9128c92f15ab 100644 --- a/src/google-maps/map-rectangle/map-rectangle.spec.ts +++ b/src/google-maps/map-rectangle/map-rectangle.spec.ts @@ -21,8 +21,7 @@ describe('MapRectangle', () => { rectangleBounds = {east: 30, north: 15, west: 10, south: -5}; rectangleOptions = {bounds: rectangleBounds, strokeColor: 'grey', strokeOpacity: 0.8}; TestBed.configureTestingModule({ - imports: [GoogleMap, MapRectangle], - declarations: [TestApp], + imports: [TestApp], }); })); @@ -149,6 +148,8 @@ describe('MapRectangle', () => { (rectangleRightclick)="handleRightclick()"> `, + standalone: true, + imports: [GoogleMap, MapRectangle], }) class TestApp { @ViewChild(MapRectangle) rectangle: MapRectangle; diff --git a/src/google-maps/map-traffic-layer/README.md b/src/google-maps/map-traffic-layer/README.md index 0b2bb33a70e9..5035a7bad808 100644 --- a/src/google-maps/map-traffic-layer/README.md +++ b/src/google-maps/map-traffic-layer/README.md @@ -7,10 +7,13 @@ The `MapTrafficLayer` component wraps the [`google.maps.TrafficLayer` class](htt ```typescript // google-maps-demo.component.ts import {Component} from '@angular/core'; +import {GoogleMap, MapTrafficLayer} from '@angular/google-maps'; @Component({ selector: 'google-map-demo', templateUrl: 'google-map-demo.html', + standalone: true, + imports: [GoogleMap, MapTrafficLayer], }) export class GoogleMapDemo { center: google.maps.LatLngLiteral = {lat: 24, lng: 12}; diff --git a/src/google-maps/map-traffic-layer/map-traffic-layer.spec.ts b/src/google-maps/map-traffic-layer/map-traffic-layer.spec.ts index 94358d407340..9d5cd8885262 100644 --- a/src/google-maps/map-traffic-layer/map-traffic-layer.spec.ts +++ b/src/google-maps/map-traffic-layer/map-traffic-layer.spec.ts @@ -17,8 +17,7 @@ describe('MapTrafficLayer', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [GoogleMap, MapTrafficLayer], - declarations: [TestApp], + imports: [TestApp], }); })); @@ -53,6 +52,8 @@ describe('MapTrafficLayer', () => { `, + standalone: true, + imports: [GoogleMap, MapTrafficLayer], }) class TestApp { autoRefresh?: boolean; diff --git a/src/google-maps/map-transit-layer/README.md b/src/google-maps/map-transit-layer/README.md index 66d9c2707f11..0fd5ec509d53 100644 --- a/src/google-maps/map-transit-layer/README.md +++ b/src/google-maps/map-transit-layer/README.md @@ -7,10 +7,13 @@ The `MapTransitLayer` component wraps the [`google.maps.TransitLayer` class](htt ```typescript // google-maps-demo.component.ts import {Component} from '@angular/core'; +import {GoogleMap, MapTransitLayer} from '@angular/google-maps'; @Component({ selector: 'google-map-demo', templateUrl: 'google-map-demo.html', + standalone: true, + imports: [GoogleMap, MapTransitLayer], }) export class GoogleMapDemo { center: google.maps.LatLngLiteral = {lat: 24, lng: 12}; diff --git a/src/google-maps/map-transit-layer/map-transit-layer.spec.ts b/src/google-maps/map-transit-layer/map-transit-layer.spec.ts index ec8f2047d84c..6775b476adae 100644 --- a/src/google-maps/map-transit-layer/map-transit-layer.spec.ts +++ b/src/google-maps/map-transit-layer/map-transit-layer.spec.ts @@ -16,8 +16,7 @@ describe('MapTransitLayer', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [GoogleMap, MapTransitLayer], - declarations: [TestApp], + imports: [TestApp], }); })); @@ -50,5 +49,7 @@ describe('MapTransitLayer', () => { template: ` `, + standalone: true, + imports: [GoogleMap, MapTransitLayer], }) class TestApp {}