diff --git a/src/maps/event/mvcobject.ts b/src/maps/event/mvcobject.ts index ef8c8ad22..ee9a1ecc0 100644 --- a/src/maps/event/mvcobject.ts +++ b/src/maps/event/mvcobject.ts @@ -23,7 +23,7 @@ export class MVCObject implements google.maps.MVCObject { public static _mockClasses: (typeof MVCObject)[] = []; public static mockInstances: MVCObject[] = []; - public constructor() { + constructor() { const ctor = this.constructor as typeof MVCObject; __registerMockInstance(ctor, this); diff --git a/src/maps/maps/map.ts b/src/maps/maps/map.ts index 04be4a00f..f4ddf1a6f 100644 --- a/src/maps/maps/map.ts +++ b/src/maps/maps/map.ts @@ -16,6 +16,7 @@ import { StreetViewPanorama } from "../../street-view/rendering/panorama"; import { LatLng, LatLngBounds } from "../coordinates/latlng"; +import { MapsEventListener } from "../event/event"; import { MVCObject } from "../event/mvcobject"; import { FeatureLayer } from "./featurelayer"; @@ -25,26 +26,17 @@ export class Map_ extends MVCObject implements google.maps.Map { public mapTypes: google.maps.MapTypeRegistry; public overlayMapTypes: google.maps.MVCArray; - constructor(mapDiv: Element | null, opts?: google.maps.MapOptions) { - super(); - this.data = new google.maps.Data(); - this.controls = [ - new google.maps.MVCArray(), // BOTTOM_CENTER - new google.maps.MVCArray(), // BOTTOM_LEFT - new google.maps.MVCArray(), // BOTTOM_RIGHT - new google.maps.MVCArray(), // LEFT_BOTTOM - new google.maps.MVCArray(), // LEFT_CENTER - new google.maps.MVCArray(), // LEFT_TOP - new google.maps.MVCArray(), // RIGHT_BOTTOM - new google.maps.MVCArray(), // RIGHT_CENTER - new google.maps.MVCArray(), // RIGHT_TOP - new google.maps.MVCArray(), // TOP_CENTER - new google.maps.MVCArray(), // TOP_LEFT - new google.maps.MVCArray(), // TOP_RIGHT - ]; - this.mapTypes = new google.maps.MVCObject(); - this.overlayMapTypes = new google.maps.MVCArray(); - } + public getFeatureLayer = jest.fn( + (featureType: google.maps.FeatureType) => new FeatureLayer() + ); + + public getMapCapabilities = jest.fn(() => { + return { + isAdvancedMarkersAvailable: false, + isDataDrivenStylingAvailable: false, + }; + }); + public fitBounds = jest .fn() .mockImplementation( @@ -147,13 +139,25 @@ export class Map_ extends MVCObject implements google.maps.Map { .mockImplementation((clickable: boolean): void => { return null; }); - public getFeatureLayer = jest.fn( - (featureType: google.maps.FeatureType) => new FeatureLayer() - ); - public getMapCapabilities = jest.fn(() => { - return { - isAdvancedMarkersAvailable: false, - isDataDrivenStylingAvailable: false, - }; - }); + + constructor(mapDiv: Element | null, opts?: google.maps.MapOptions) { + super(); + this.data = new google.maps.Data(); + this.controls = [ + new google.maps.MVCArray(), // BOTTOM_CENTER + new google.maps.MVCArray(), // BOTTOM_LEFT + new google.maps.MVCArray(), // BOTTOM_RIGHT + new google.maps.MVCArray(), // LEFT_BOTTOM + new google.maps.MVCArray(), // LEFT_CENTER + new google.maps.MVCArray(), // LEFT_TOP + new google.maps.MVCArray(), // RIGHT_BOTTOM + new google.maps.MVCArray(), // RIGHT_CENTER + new google.maps.MVCArray(), // RIGHT_TOP + new google.maps.MVCArray(), // TOP_CENTER + new google.maps.MVCArray(), // TOP_LEFT + new google.maps.MVCArray(), // TOP_RIGHT + ]; + this.mapTypes = new google.maps.MVCObject(); + this.overlayMapTypes = new google.maps.MVCArray(); + } } diff --git a/src/street-view/rendering/panorama.ts b/src/street-view/rendering/panorama.ts index 5cf009a84..d233887f0 100644 --- a/src/street-view/rendering/panorama.ts +++ b/src/street-view/rendering/panorama.ts @@ -22,6 +22,7 @@ export class StreetViewPanorama extends MVCObject implements google.maps.StreetViewPanorama { + public focus = jest.fn().mockImplementation((): void => {}); public controls: MVCArray[] = []; public getLinks = jest .fn() @@ -93,5 +94,4 @@ export class StreetViewPanorama .fn() .mockImplementation((flag: boolean): void => null); public setZoom = jest.fn().mockImplementation((zoom: number): void => null); - public focus = jest.fn(); }