@@ -54,8 +54,9 @@ export function createMapSpy(options: google.maps.MapOptions): jasmine.SpyObj<go
5454/** Creates a jasmine.Spy to watch for the constructor of a google.maps.Map. */
5555export function createMapConstructorSpy (
5656 mapSpy : jasmine . SpyObj < google . maps . Map > , apiLoaded = true ) : jasmine . Spy {
57+ // The spy target function cannot be an arrow-function as this breaks when created through `new`.
5758 const mapConstructorSpy =
58- jasmine . createSpy ( 'Map constructor' , ( _el : Element , _options : google . maps . MapOptions ) => {
59+ jasmine . createSpy ( 'Map constructor' , function ( ) {
5960 return mapSpy ;
6061 } ) ;
6162 const testingWindow : TestingWindow = window ;
@@ -84,8 +85,9 @@ export function createMarkerSpy(options: google.maps.MarkerOptions):
8485/** Creates a jasmine.Spy to watch for the constructor of a google.maps.Marker */
8586export function createMarkerConstructorSpy ( markerSpy : jasmine . SpyObj < google . maps . Marker > ) :
8687 jasmine . Spy {
88+ // The spy target function cannot be an arrow-function as this breaks when created through `new`.
8789 const markerConstructorSpy =
88- jasmine . createSpy ( 'Marker constructor' , ( _options : google . maps . MarkerOptions ) => {
90+ jasmine . createSpy ( 'Marker constructor' , function ( ) {
8991 return markerSpy ;
9092 } ) ;
9193 const testingWindow : TestingWindow = window ;
@@ -118,8 +120,9 @@ export function createInfoWindowSpy(options: google.maps.InfoWindowOptions):
118120/** Creates a jasmine.Spy to watch for the constructor of a google.maps.InfoWindow */
119121export function createInfoWindowConstructorSpy (
120122 infoWindowSpy : jasmine . SpyObj < google . maps . InfoWindow > ) : jasmine . Spy {
123+ // The spy target function cannot be an arrow-function as this breaks when created through `new`.
121124 const infoWindowConstructorSpy =
122- jasmine . createSpy ( 'InfoWindow constructor' , ( _options : google . maps . InfoWindowOptions ) => {
125+ jasmine . createSpy ( 'InfoWindow constructor' , function ( ) {
123126 return infoWindowSpy ;
124127 } ) ;
125128 const testingWindow : TestingWindow = window ;
@@ -149,8 +152,9 @@ export function createPolylineSpy(options: google.maps.PolylineOptions):
149152/** Creates a jasmine.Spy to watch for the constructor of a google.maps.Polyline */
150153export function createPolylineConstructorSpy ( polylineSpy : jasmine . SpyObj < google . maps . Polyline > ) :
151154 jasmine . Spy {
155+ // The spy target function cannot be an arrow-function as this breaks when created through `new`.
152156 const polylineConstructorSpy =
153- jasmine . createSpy ( 'Polyline constructor' , ( _options : google . maps . PolylineOptions ) => {
157+ jasmine . createSpy ( 'Polyline constructor' , function ( ) {
154158 return polylineSpy ;
155159 } ) ;
156160 const testingWindow : TestingWindow = window ;
@@ -180,8 +184,9 @@ export function createPolygonSpy(options: google.maps.PolygonOptions):
180184/** Creates a jasmine.Spy to watch for the constructor of a google.maps.Polygon */
181185export function createPolygonConstructorSpy ( polygonSpy : jasmine . SpyObj < google . maps . Polygon > ) :
182186 jasmine . Spy {
187+ // The spy target function cannot be an arrow-function as this breaks when created through `new`.
183188 const polygonConstructorSpy =
184- jasmine . createSpy ( 'Polygon constructor' , ( _options : google . maps . PolygonOptions ) => {
189+ jasmine . createSpy ( 'Polygon constructor' , function ( ) {
185190 return polygonSpy ;
186191 } ) ;
187192 const testingWindow : TestingWindow = window ;
@@ -211,8 +216,9 @@ export function createRectangleSpy(options: google.maps.RectangleOptions):
211216/** Creates a jasmine.Spy to watch for the constructor of a google.maps.Rectangle */
212217export function createRectangleConstructorSpy ( rectangleSpy : jasmine . SpyObj < google . maps . Rectangle > ) :
213218 jasmine . Spy {
219+ // The spy target function cannot be an arrow-function as this breaks when created through `new`.
214220 const rectangleConstructorSpy =
215- jasmine . createSpy ( 'Rectangle constructor' , ( _options : google . maps . RectangleOptions ) => {
221+ jasmine . createSpy ( 'Rectangle constructor' , function ( ) {
216222 return rectangleSpy ;
217223 } ) ;
218224 const testingWindow : TestingWindow = window ;
@@ -242,10 +248,10 @@ export function createCircleSpy(options: google.maps.CircleOptions):
242248/** Creates a jasmine.Spy to watch for the constructor of a google.maps.Circle */
243249export function createCircleConstructorSpy ( circleSpy : jasmine . SpyObj < google . maps . Circle > ) :
244250 jasmine . Spy {
245- const circleConstructorSpy =
246- jasmine . createSpy ( 'Circle constructor' , ( _options : google . maps . CircleOptions ) => {
247- return circleSpy ;
248- } ) ;
251+ // The spy target function cannot be an arrow-function as this breaks when created through `new`.
252+ const circleConstructorSpy = jasmine . createSpy ( 'Circle constructor' , function ( ) {
253+ return circleSpy ;
254+ } ) ;
249255 const testingWindow : TestingWindow = window ;
250256 if ( testingWindow . google && testingWindow . google . maps ) {
251257 testingWindow . google . maps [ 'Circle' ] = circleConstructorSpy ;
@@ -281,12 +287,10 @@ export function createGroundOverlaySpy(
281287/** Creates a jasmine.Spy to watch for the constructor of a google.maps.GroundOverlay */
282288export function createGroundOverlayConstructorSpy (
283289 groundOverlaySpy : jasmine . SpyObj < google . maps . GroundOverlay > ) : jasmine . Spy {
284- const groundOverlayConstructorSpy = jasmine . createSpy (
285- 'GroundOverlay constructor' ,
286- ( _url : string , _bounds : google . maps . LatLngBoundsLiteral ,
287- _options : google . maps . GroundOverlayOptions ) => {
288- return groundOverlaySpy ;
289- } ) ;
290+ // The spy target function cannot be an arrow-function as this breaks when created through `new`.
291+ const groundOverlayConstructorSpy = jasmine . createSpy ( 'GroundOverlay constructor' , function ( ) {
292+ return groundOverlaySpy ;
293+ } ) ;
290294 const testingWindow : TestingWindow = window ;
291295 if ( testingWindow . google && testingWindow . google . maps ) {
292296 testingWindow . google . maps [ 'GroundOverlay' ] = groundOverlayConstructorSpy ;
@@ -321,8 +325,9 @@ export function createKmlLayerSpy(options?: google.maps.KmlLayerOptions):
321325/** Creates a jasmine.Spy to watch for the constructor of a google.maps.KmlLayer */
322326export function createKmlLayerConstructorSpy ( kmlLayerSpy : jasmine . SpyObj < google . maps . KmlLayer > ) :
323327 jasmine . Spy {
328+ // The spy target function cannot be an arrow-function as this breaks when created through `new`.
324329 const kmlLayerConstructorSpy =
325- jasmine . createSpy ( 'KmlLayer constructor' , ( _options : google . maps . KmlLayerOptions ) => {
330+ jasmine . createSpy ( 'KmlLayer constructor' , function ( ) {
326331 return kmlLayerSpy ;
327332 } ) ;
328333 const testingWindow : TestingWindow = window ;
@@ -351,8 +356,9 @@ export function createTrafficLayerSpy(options?: google.maps.TrafficLayerOptions)
351356/** Creates a jasmine.Spy to watch for the constructor of a google.maps.TrafficLayer */
352357export function createTrafficLayerConstructorSpy (
353358 trafficLayerSpy : jasmine . SpyObj < google . maps . TrafficLayer > ) : jasmine . Spy {
359+ // The spy target function cannot be an arrow-function as this breaks when created through `new`.
354360 const trafficLayerConstructorSpy =
355- jasmine . createSpy ( 'TrafficLayer constructor' , ( _options : google . maps . TrafficLayerOptions ) => {
361+ jasmine . createSpy ( 'TrafficLayer constructor' , function ( ) {
356362 return trafficLayerSpy ;
357363 } ) ;
358364 const testingWindow : TestingWindow = window ;
@@ -379,7 +385,8 @@ export function createTransitLayerSpy(): jasmine.SpyObj<google.maps.TransitLayer
379385/** Creates a jasmine.Spy to watch for the constructor of a google.maps.TransitLayer */
380386export function createTransitLayerConstructorSpy (
381387 transitLayerSpy : jasmine . SpyObj < google . maps . TransitLayer > ) : jasmine . Spy {
382- const transitLayerConstructorSpy = jasmine . createSpy ( 'TransitLayer constructor' , ( ) => {
388+ // The spy target function cannot be an arrow-function as this breaks when created through `new`.
389+ const transitLayerConstructorSpy = jasmine . createSpy ( 'TransitLayer constructor' , function ( ) {
383390 return transitLayerSpy ;
384391 } ) ;
385392 const testingWindow : TestingWindow = window ;
@@ -406,7 +413,8 @@ export function createBicyclingLayerSpy(): jasmine.SpyObj<google.maps.BicyclingL
406413/** Creates a jasmine.Spy to watch for the constructor of a google.maps.BicyclingLayer */
407414export function createBicyclingLayerConstructorSpy (
408415 bicylingLayerSpy : jasmine . SpyObj < google . maps . BicyclingLayer > ) : jasmine . Spy {
409- const bicylingLayerConstructorSpy = jasmine . createSpy ( 'BicyclingLayer constructor' , ( ) => {
416+ // The spy target function cannot be an arrow-function as this breaks when created through `new`.
417+ const bicylingLayerConstructorSpy = jasmine . createSpy ( 'BicyclingLayer constructor' , function ( ) {
410418 return bicylingLayerSpy ;
411419 } ) ;
412420 const testingWindow : TestingWindow = window ;
@@ -443,10 +451,9 @@ export function createMarkerClustererSpy(): jasmine.SpyObj<MarkerClusterer> {
443451/** Creates a jasmine.Spy to watch for the constructor of a MarkerClusterer */
444452export function createMarkerClustererConstructorSpy (
445453 markerClustererSpy : jasmine . SpyObj < MarkerClusterer > , apiLoaded = true ) : jasmine . Spy {
454+ // The spy target function cannot be an arrow-function as this breaks when created through `new`.
446455 const markerClustererConstructorSpy = jasmine . createSpy ( 'MarkerClusterer constructor' ,
447- ( ) => {
448- return markerClustererSpy ;
449- } ) ;
456+ function ( ) { return markerClustererSpy ; } ) ;
450457 if ( apiLoaded ) {
451458 const testingWindow : TestingWindow = window ;
452459 testingWindow [ 'MarkerClusterer' ] = markerClustererConstructorSpy ;
@@ -467,10 +474,9 @@ export function createDirectionsRendererSpy(options: google.maps.DirectionsRende
467474/** Creates a jasmine.Spy to watch for the constructor of a DirectionsRenderer */
468475export function createDirectionsRendererConstructorSpy (
469476 directionsRendererSpy : jasmine . SpyObj < google . maps . DirectionsRenderer > ) : jasmine . Spy {
477+ // The spy target function cannot be an arrow-function as this breaks when created through `new`.
470478 const directionsRendererConstructorSpy = jasmine . createSpy ( 'DirectionsRenderer constructor' ,
471- ( _options : google . maps . DirectionsRendererOptions ) => {
472- return directionsRendererSpy ;
473- } ) ;
479+ function ( ) { return directionsRendererSpy ; } ) ;
474480 const testingWindow : TestingWindow = window ;
475481 if ( testingWindow . google && testingWindow . google . maps ) {
476482 testingWindow . google . maps [ 'DirectionsRenderer' ] = directionsRendererConstructorSpy ;
@@ -493,8 +499,9 @@ export function createDirectionsServiceSpy(): jasmine.SpyObj<google.maps.Directi
493499/** Creates a jasmine.Spy to watch for the constructor of the DirectionsService */
494500export function createDirectionsServiceConstructorSpy (
495501 directionsServiceSpy : jasmine . SpyObj < google . maps . DirectionsService > ) : jasmine . Spy {
496- const directionsServiceConstructorSpy =
497- jasmine . createSpy ( 'DirectionsService constructor' , ( ) => directionsServiceSpy ) ;
502+ // The spy target function cannot be an arrow-function as this breaks when created through `new`.
503+ const directionsServiceConstructorSpy = jasmine . createSpy ( 'DirectionsService constructor' ,
504+ function ( ) { return directionsServiceSpy ; } ) ;
498505 const testingWindow : TestingWindow = window ;
499506 if ( testingWindow . google && testingWindow . google . maps ) {
500507 testingWindow . google . maps [ 'DirectionsService' ] = directionsServiceConstructorSpy ;
@@ -522,7 +529,8 @@ export function createHeatmapLayerSpy(): jasmine.SpyObj<google.maps.visualizatio
522529 */
523530export function createHeatmapLayerConstructorSpy (
524531 heatmapLayerSpy : jasmine . SpyObj < google . maps . visualization . HeatmapLayer > ) : jasmine . Spy {
525- const heatmapLayerConstructorSpy = jasmine . createSpy ( 'HeatmapLayer constructor' , ( ) => {
532+ // The spy target function cannot be an arrow-function as this breaks when created through `new`.
533+ const heatmapLayerConstructorSpy = jasmine . createSpy ( 'HeatmapLayer constructor' , function ( ) {
526534 return heatmapLayerSpy ;
527535 } ) ;
528536 const testingWindow : TestingWindow = window ;
@@ -552,7 +560,9 @@ export function createLatLngSpy(): jasmine.SpyObj<google.maps.LatLng> {
552560/** Creates a jasmine.Spy to watch for the constructor of a google.maps.LatLng */
553561export function createLatLngConstructorSpy (
554562 latLngSpy : jasmine . SpyObj < google . maps . LatLng > ) : jasmine . Spy {
555- const latLngConstructorSpy = jasmine . createSpy ( 'LatLng constructor' , ( ) => latLngSpy ) ;
563+ // The spy target function cannot be an arrow-function as this breaks when created through `new`.
564+ const latLngConstructorSpy = jasmine . createSpy ( 'LatLng constructor' ,
565+ function ( ) { return latLngSpy ; } ) ;
556566 const testingWindow : TestingWindow = window ;
557567 if ( testingWindow . google && testingWindow . google . maps ) {
558568 testingWindow . google . maps [ 'LatLng' ] = latLngConstructorSpy ;
@@ -574,7 +584,9 @@ export function createGeocoderSpy(): jasmine.SpyObj<google.maps.Geocoder> {
574584/** Creates a jasmine.Spy to watch for the constructor of the Geocoder. */
575585export function createGeocoderConstructorSpy (
576586 geocoderSpy : jasmine . SpyObj < google . maps . Geocoder > ) : jasmine . Spy {
577- const geocoderConstructorSpy = jasmine . createSpy ( 'Geocoder constructor' , ( ) => geocoderSpy ) ;
587+ // The spy target function cannot be an arrow-function as this breaks when created through `new`.
588+ const geocoderConstructorSpy = jasmine . createSpy ( 'Geocoder constructor' ,
589+ function ( ) { return geocoderSpy ; } ) ;
578590 const testingWindow : TestingWindow = window ;
579591 if ( testingWindow . google && testingWindow . google . maps ) {
580592 testingWindow . google . maps [ 'Geocoder' ] = geocoderConstructorSpy ;
0 commit comments