Skip to content

Commit 3d0da9f

Browse files
authored
fix: typescipt and eslint errors (#406)
* fix: typescipt and eslint errors * style(map): remove whitespace * fix(panorama): remove double implementation of focus
1 parent 7db11ad commit 3d0da9f

File tree

3 files changed

+35
-31
lines changed

3 files changed

+35
-31
lines changed

src/maps/event/mvcobject.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class MVCObject implements google.maps.MVCObject {
2323
public static _mockClasses: (typeof MVCObject)[] = [];
2424
public static mockInstances: MVCObject[] = [];
2525

26-
public constructor() {
26+
constructor() {
2727
const ctor = this.constructor as typeof MVCObject;
2828

2929
__registerMockInstance(ctor, this);

src/maps/maps/map.ts

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import { StreetViewPanorama } from "../../street-view/rendering/panorama";
1818
import { LatLng, LatLngBounds } from "../coordinates/latlng";
19+
import { MapsEventListener } from "../event/event";
1920
import { MVCObject } from "../event/mvcobject";
2021
import { FeatureLayer } from "./featurelayer";
2122

@@ -25,26 +26,17 @@ export class Map_ extends MVCObject implements google.maps.Map {
2526
public mapTypes: google.maps.MapTypeRegistry;
2627
public overlayMapTypes: google.maps.MVCArray<google.maps.MapType>;
2728

28-
constructor(mapDiv: Element | null, opts?: google.maps.MapOptions) {
29-
super();
30-
this.data = new google.maps.Data();
31-
this.controls = [
32-
new google.maps.MVCArray<HTMLElement>(), // BOTTOM_CENTER
33-
new google.maps.MVCArray<HTMLElement>(), // BOTTOM_LEFT
34-
new google.maps.MVCArray<HTMLElement>(), // BOTTOM_RIGHT
35-
new google.maps.MVCArray<HTMLElement>(), // LEFT_BOTTOM
36-
new google.maps.MVCArray<HTMLElement>(), // LEFT_CENTER
37-
new google.maps.MVCArray<HTMLElement>(), // LEFT_TOP
38-
new google.maps.MVCArray<HTMLElement>(), // RIGHT_BOTTOM
39-
new google.maps.MVCArray<HTMLElement>(), // RIGHT_CENTER
40-
new google.maps.MVCArray<HTMLElement>(), // RIGHT_TOP
41-
new google.maps.MVCArray<HTMLElement>(), // TOP_CENTER
42-
new google.maps.MVCArray<HTMLElement>(), // TOP_LEFT
43-
new google.maps.MVCArray<HTMLElement>(), // TOP_RIGHT
44-
];
45-
this.mapTypes = new google.maps.MVCObject();
46-
this.overlayMapTypes = new google.maps.MVCArray();
47-
}
29+
public getFeatureLayer = jest.fn(
30+
(featureType: google.maps.FeatureType) => new FeatureLayer()
31+
);
32+
33+
public getMapCapabilities = jest.fn(() => {
34+
return {
35+
isAdvancedMarkersAvailable: false,
36+
isDataDrivenStylingAvailable: false,
37+
};
38+
});
39+
4840
public fitBounds = jest
4941
.fn()
5042
.mockImplementation(
@@ -147,13 +139,25 @@ export class Map_ extends MVCObject implements google.maps.Map {
147139
.mockImplementation((clickable: boolean): void => {
148140
return null;
149141
});
150-
public getFeatureLayer = jest.fn(
151-
(featureType: google.maps.FeatureType) => new FeatureLayer()
152-
);
153-
public getMapCapabilities = jest.fn(() => {
154-
return {
155-
isAdvancedMarkersAvailable: false,
156-
isDataDrivenStylingAvailable: false,
157-
};
158-
});
142+
143+
constructor(mapDiv: Element | null, opts?: google.maps.MapOptions) {
144+
super();
145+
this.data = new google.maps.Data();
146+
this.controls = [
147+
new google.maps.MVCArray<HTMLElement>(), // BOTTOM_CENTER
148+
new google.maps.MVCArray<HTMLElement>(), // BOTTOM_LEFT
149+
new google.maps.MVCArray<HTMLElement>(), // BOTTOM_RIGHT
150+
new google.maps.MVCArray<HTMLElement>(), // LEFT_BOTTOM
151+
new google.maps.MVCArray<HTMLElement>(), // LEFT_CENTER
152+
new google.maps.MVCArray<HTMLElement>(), // LEFT_TOP
153+
new google.maps.MVCArray<HTMLElement>(), // RIGHT_BOTTOM
154+
new google.maps.MVCArray<HTMLElement>(), // RIGHT_CENTER
155+
new google.maps.MVCArray<HTMLElement>(), // RIGHT_TOP
156+
new google.maps.MVCArray<HTMLElement>(), // TOP_CENTER
157+
new google.maps.MVCArray<HTMLElement>(), // TOP_LEFT
158+
new google.maps.MVCArray<HTMLElement>(), // TOP_RIGHT
159+
];
160+
this.mapTypes = new google.maps.MVCObject();
161+
this.overlayMapTypes = new google.maps.MVCArray();
162+
}
159163
}

src/street-view/rendering/panorama.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export class StreetViewPanorama
2222
extends MVCObject
2323
implements google.maps.StreetViewPanorama
2424
{
25+
public focus = jest.fn().mockImplementation((): void => {});
2526
public controls: MVCArray<HTMLElement>[] = [];
2627
public getLinks = jest
2728
.fn()
@@ -93,5 +94,4 @@ export class StreetViewPanorama
9394
.fn()
9495
.mockImplementation((flag: boolean): void => null);
9596
public setZoom = jest.fn().mockImplementation((zoom: number): void => null);
96-
public focus = jest.fn();
9797
}

0 commit comments

Comments
 (0)