@@ -54,8 +54,9 @@ export function createMapSpy(options: google.maps.MapOptions): jasmine.SpyObj<go
54
54
/** Creates a jasmine.Spy to watch for the constructor of a google.maps.Map. */
55
55
export function createMapConstructorSpy (
56
56
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`.
57
58
const mapConstructorSpy =
58
- jasmine . createSpy ( 'Map constructor' , ( _el : Element , _options : google . maps . MapOptions ) => {
59
+ jasmine . createSpy ( 'Map constructor' , function ( ) {
59
60
return mapSpy ;
60
61
} ) ;
61
62
const testingWindow : TestingWindow = window ;
@@ -84,8 +85,9 @@ export function createMarkerSpy(options: google.maps.MarkerOptions):
84
85
/** Creates a jasmine.Spy to watch for the constructor of a google.maps.Marker */
85
86
export function createMarkerConstructorSpy ( markerSpy : jasmine . SpyObj < google . maps . Marker > ) :
86
87
jasmine . Spy {
88
+ // The spy target function cannot be an arrow-function as this breaks when created through `new`.
87
89
const markerConstructorSpy =
88
- jasmine . createSpy ( 'Marker constructor' , ( _options : google . maps . MarkerOptions ) => {
90
+ jasmine . createSpy ( 'Marker constructor' , function ( ) {
89
91
return markerSpy ;
90
92
} ) ;
91
93
const testingWindow : TestingWindow = window ;
@@ -118,8 +120,9 @@ export function createInfoWindowSpy(options: google.maps.InfoWindowOptions):
118
120
/** Creates a jasmine.Spy to watch for the constructor of a google.maps.InfoWindow */
119
121
export function createInfoWindowConstructorSpy (
120
122
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`.
121
124
const infoWindowConstructorSpy =
122
- jasmine . createSpy ( 'InfoWindow constructor' , ( _options : google . maps . InfoWindowOptions ) => {
125
+ jasmine . createSpy ( 'InfoWindow constructor' , function ( ) {
123
126
return infoWindowSpy ;
124
127
} ) ;
125
128
const testingWindow : TestingWindow = window ;
@@ -149,8 +152,9 @@ export function createPolylineSpy(options: google.maps.PolylineOptions):
149
152
/** Creates a jasmine.Spy to watch for the constructor of a google.maps.Polyline */
150
153
export function createPolylineConstructorSpy ( polylineSpy : jasmine . SpyObj < google . maps . Polyline > ) :
151
154
jasmine . Spy {
155
+ // The spy target function cannot be an arrow-function as this breaks when created through `new`.
152
156
const polylineConstructorSpy =
153
- jasmine . createSpy ( 'Polyline constructor' , ( _options : google . maps . PolylineOptions ) => {
157
+ jasmine . createSpy ( 'Polyline constructor' , function ( ) {
154
158
return polylineSpy ;
155
159
} ) ;
156
160
const testingWindow : TestingWindow = window ;
@@ -180,8 +184,9 @@ export function createPolygonSpy(options: google.maps.PolygonOptions):
180
184
/** Creates a jasmine.Spy to watch for the constructor of a google.maps.Polygon */
181
185
export function createPolygonConstructorSpy ( polygonSpy : jasmine . SpyObj < google . maps . Polygon > ) :
182
186
jasmine . Spy {
187
+ // The spy target function cannot be an arrow-function as this breaks when created through `new`.
183
188
const polygonConstructorSpy =
184
- jasmine . createSpy ( 'Polygon constructor' , ( _options : google . maps . PolygonOptions ) => {
189
+ jasmine . createSpy ( 'Polygon constructor' , function ( ) {
185
190
return polygonSpy ;
186
191
} ) ;
187
192
const testingWindow : TestingWindow = window ;
@@ -211,8 +216,9 @@ export function createRectangleSpy(options: google.maps.RectangleOptions):
211
216
/** Creates a jasmine.Spy to watch for the constructor of a google.maps.Rectangle */
212
217
export function createRectangleConstructorSpy ( rectangleSpy : jasmine . SpyObj < google . maps . Rectangle > ) :
213
218
jasmine . Spy {
219
+ // The spy target function cannot be an arrow-function as this breaks when created through `new`.
214
220
const rectangleConstructorSpy =
215
- jasmine . createSpy ( 'Rectangle constructor' , ( _options : google . maps . RectangleOptions ) => {
221
+ jasmine . createSpy ( 'Rectangle constructor' , function ( ) {
216
222
return rectangleSpy ;
217
223
} ) ;
218
224
const testingWindow : TestingWindow = window ;
@@ -242,10 +248,10 @@ export function createCircleSpy(options: google.maps.CircleOptions):
242
248
/** Creates a jasmine.Spy to watch for the constructor of a google.maps.Circle */
243
249
export function createCircleConstructorSpy ( circleSpy : jasmine . SpyObj < google . maps . Circle > ) :
244
250
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
+ } ) ;
249
255
const testingWindow : TestingWindow = window ;
250
256
if ( testingWindow . google && testingWindow . google . maps ) {
251
257
testingWindow . google . maps [ 'Circle' ] = circleConstructorSpy ;
@@ -281,12 +287,10 @@ export function createGroundOverlaySpy(
281
287
/** Creates a jasmine.Spy to watch for the constructor of a google.maps.GroundOverlay */
282
288
export function createGroundOverlayConstructorSpy (
283
289
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
+ } ) ;
290
294
const testingWindow : TestingWindow = window ;
291
295
if ( testingWindow . google && testingWindow . google . maps ) {
292
296
testingWindow . google . maps [ 'GroundOverlay' ] = groundOverlayConstructorSpy ;
@@ -321,8 +325,9 @@ export function createKmlLayerSpy(options?: google.maps.KmlLayerOptions):
321
325
/** Creates a jasmine.Spy to watch for the constructor of a google.maps.KmlLayer */
322
326
export function createKmlLayerConstructorSpy ( kmlLayerSpy : jasmine . SpyObj < google . maps . KmlLayer > ) :
323
327
jasmine . Spy {
328
+ // The spy target function cannot be an arrow-function as this breaks when created through `new`.
324
329
const kmlLayerConstructorSpy =
325
- jasmine . createSpy ( 'KmlLayer constructor' , ( _options : google . maps . KmlLayerOptions ) => {
330
+ jasmine . createSpy ( 'KmlLayer constructor' , function ( ) {
326
331
return kmlLayerSpy ;
327
332
} ) ;
328
333
const testingWindow : TestingWindow = window ;
@@ -351,8 +356,9 @@ export function createTrafficLayerSpy(options?: google.maps.TrafficLayerOptions)
351
356
/** Creates a jasmine.Spy to watch for the constructor of a google.maps.TrafficLayer */
352
357
export function createTrafficLayerConstructorSpy (
353
358
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`.
354
360
const trafficLayerConstructorSpy =
355
- jasmine . createSpy ( 'TrafficLayer constructor' , ( _options : google . maps . TrafficLayerOptions ) => {
361
+ jasmine . createSpy ( 'TrafficLayer constructor' , function ( ) {
356
362
return trafficLayerSpy ;
357
363
} ) ;
358
364
const testingWindow : TestingWindow = window ;
@@ -379,7 +385,8 @@ export function createTransitLayerSpy(): jasmine.SpyObj<google.maps.TransitLayer
379
385
/** Creates a jasmine.Spy to watch for the constructor of a google.maps.TransitLayer */
380
386
export function createTransitLayerConstructorSpy (
381
387
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 ( ) {
383
390
return transitLayerSpy ;
384
391
} ) ;
385
392
const testingWindow : TestingWindow = window ;
@@ -406,7 +413,8 @@ export function createBicyclingLayerSpy(): jasmine.SpyObj<google.maps.BicyclingL
406
413
/** Creates a jasmine.Spy to watch for the constructor of a google.maps.BicyclingLayer */
407
414
export function createBicyclingLayerConstructorSpy (
408
415
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 ( ) {
410
418
return bicylingLayerSpy ;
411
419
} ) ;
412
420
const testingWindow : TestingWindow = window ;
@@ -443,10 +451,9 @@ export function createMarkerClustererSpy(): jasmine.SpyObj<MarkerClusterer> {
443
451
/** Creates a jasmine.Spy to watch for the constructor of a MarkerClusterer */
444
452
export function createMarkerClustererConstructorSpy (
445
453
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`.
446
455
const markerClustererConstructorSpy = jasmine . createSpy ( 'MarkerClusterer constructor' ,
447
- ( ) => {
448
- return markerClustererSpy ;
449
- } ) ;
456
+ function ( ) { return markerClustererSpy ; } ) ;
450
457
if ( apiLoaded ) {
451
458
const testingWindow : TestingWindow = window ;
452
459
testingWindow [ 'MarkerClusterer' ] = markerClustererConstructorSpy ;
@@ -467,10 +474,9 @@ export function createDirectionsRendererSpy(options: google.maps.DirectionsRende
467
474
/** Creates a jasmine.Spy to watch for the constructor of a DirectionsRenderer */
468
475
export function createDirectionsRendererConstructorSpy (
469
476
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`.
470
478
const directionsRendererConstructorSpy = jasmine . createSpy ( 'DirectionsRenderer constructor' ,
471
- ( _options : google . maps . DirectionsRendererOptions ) => {
472
- return directionsRendererSpy ;
473
- } ) ;
479
+ function ( ) { return directionsRendererSpy ; } ) ;
474
480
const testingWindow : TestingWindow = window ;
475
481
if ( testingWindow . google && testingWindow . google . maps ) {
476
482
testingWindow . google . maps [ 'DirectionsRenderer' ] = directionsRendererConstructorSpy ;
@@ -493,8 +499,9 @@ export function createDirectionsServiceSpy(): jasmine.SpyObj<google.maps.Directi
493
499
/** Creates a jasmine.Spy to watch for the constructor of the DirectionsService */
494
500
export function createDirectionsServiceConstructorSpy (
495
501
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 ; } ) ;
498
505
const testingWindow : TestingWindow = window ;
499
506
if ( testingWindow . google && testingWindow . google . maps ) {
500
507
testingWindow . google . maps [ 'DirectionsService' ] = directionsServiceConstructorSpy ;
@@ -522,7 +529,8 @@ export function createHeatmapLayerSpy(): jasmine.SpyObj<google.maps.visualizatio
522
529
*/
523
530
export function createHeatmapLayerConstructorSpy (
524
531
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 ( ) {
526
534
return heatmapLayerSpy ;
527
535
} ) ;
528
536
const testingWindow : TestingWindow = window ;
@@ -552,7 +560,9 @@ export function createLatLngSpy(): jasmine.SpyObj<google.maps.LatLng> {
552
560
/** Creates a jasmine.Spy to watch for the constructor of a google.maps.LatLng */
553
561
export function createLatLngConstructorSpy (
554
562
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 ; } ) ;
556
566
const testingWindow : TestingWindow = window ;
557
567
if ( testingWindow . google && testingWindow . google . maps ) {
558
568
testingWindow . google . maps [ 'LatLng' ] = latLngConstructorSpy ;
@@ -574,7 +584,9 @@ export function createGeocoderSpy(): jasmine.SpyObj<google.maps.Geocoder> {
574
584
/** Creates a jasmine.Spy to watch for the constructor of the Geocoder. */
575
585
export function createGeocoderConstructorSpy (
576
586
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 ; } ) ;
578
590
const testingWindow : TestingWindow = window ;
579
591
if ( testingWindow . google && testingWindow . google . maps ) {
580
592
testingWindow . google . maps [ 'Geocoder' ] = geocoderConstructorSpy ;
0 commit comments