Skip to content

Commit

Permalink
fix: typescipt and eslint errors (#406)
Browse files Browse the repository at this point in the history
* fix: typescipt and eslint errors

* style(map): remove whitespace

* fix(panorama): remove double implementation of focus
  • Loading branch information
BiniCodes authored Mar 23, 2023
1 parent 7db11ad commit 3d0da9f
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/maps/event/mvcobject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
62 changes: 33 additions & 29 deletions src/maps/maps/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

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

constructor(mapDiv: Element | null, opts?: google.maps.MapOptions) {
super();
this.data = new google.maps.Data();
this.controls = [
new google.maps.MVCArray<HTMLElement>(), // BOTTOM_CENTER
new google.maps.MVCArray<HTMLElement>(), // BOTTOM_LEFT
new google.maps.MVCArray<HTMLElement>(), // BOTTOM_RIGHT
new google.maps.MVCArray<HTMLElement>(), // LEFT_BOTTOM
new google.maps.MVCArray<HTMLElement>(), // LEFT_CENTER
new google.maps.MVCArray<HTMLElement>(), // LEFT_TOP
new google.maps.MVCArray<HTMLElement>(), // RIGHT_BOTTOM
new google.maps.MVCArray<HTMLElement>(), // RIGHT_CENTER
new google.maps.MVCArray<HTMLElement>(), // RIGHT_TOP
new google.maps.MVCArray<HTMLElement>(), // TOP_CENTER
new google.maps.MVCArray<HTMLElement>(), // TOP_LEFT
new google.maps.MVCArray<HTMLElement>(), // 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(
Expand Down Expand Up @@ -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<HTMLElement>(), // BOTTOM_CENTER
new google.maps.MVCArray<HTMLElement>(), // BOTTOM_LEFT
new google.maps.MVCArray<HTMLElement>(), // BOTTOM_RIGHT
new google.maps.MVCArray<HTMLElement>(), // LEFT_BOTTOM
new google.maps.MVCArray<HTMLElement>(), // LEFT_CENTER
new google.maps.MVCArray<HTMLElement>(), // LEFT_TOP
new google.maps.MVCArray<HTMLElement>(), // RIGHT_BOTTOM
new google.maps.MVCArray<HTMLElement>(), // RIGHT_CENTER
new google.maps.MVCArray<HTMLElement>(), // RIGHT_TOP
new google.maps.MVCArray<HTMLElement>(), // TOP_CENTER
new google.maps.MVCArray<HTMLElement>(), // TOP_LEFT
new google.maps.MVCArray<HTMLElement>(), // TOP_RIGHT
];
this.mapTypes = new google.maps.MVCObject();
this.overlayMapTypes = new google.maps.MVCArray();
}
}
2 changes: 1 addition & 1 deletion src/street-view/rendering/panorama.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export class StreetViewPanorama
extends MVCObject
implements google.maps.StreetViewPanorama
{
public focus = jest.fn().mockImplementation((): void => {});
public controls: MVCArray<HTMLElement>[] = [];
public getLinks = jest
.fn()
Expand Down Expand Up @@ -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();
}

0 comments on commit 3d0da9f

Please sign in to comment.