|
| 1 | +/** |
| 2 | + * Copyright 2019 Google LLC. All Rights Reserved. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +import { LatLng } from "../coordinates/latlng"; |
| 18 | +import { MVCObject } from "../event/mvcobject"; |
| 19 | + |
| 20 | +export class InfoWindow_ extends MVCObject implements google.maps.InfoWindow { |
| 21 | + public close = jest.fn().mockImplementation((): void => null); |
| 22 | + public getContent = jest |
| 23 | + .fn() |
| 24 | + .mockImplementation((): string | Element | null | Text | undefined => { |
| 25 | + return jest.fn() as unknown as Element; |
| 26 | + }); |
| 27 | + public getPosition = jest |
| 28 | + .fn() |
| 29 | + .mockImplementation( |
| 30 | + (): google.maps.LatLng | null | undefined => |
| 31 | + new LatLng({ lat: 0, lng: 0 }) |
| 32 | + ); |
| 33 | + public getZIndex = jest |
| 34 | + .fn() |
| 35 | + .mockImplementation((): number | null | undefined => 1); |
| 36 | + public open = jest |
| 37 | + .fn() |
| 38 | + .mockImplementation( |
| 39 | + ( |
| 40 | + options?: |
| 41 | + | google.maps.InfoWindowOpenOptions |
| 42 | + | google.maps.Map |
| 43 | + | google.maps.StreetViewPanorama, |
| 44 | + anchor?: google.maps.MVCObject |
| 45 | + ): void => null |
| 46 | + ); |
| 47 | + public setContent = jest |
| 48 | + .fn() |
| 49 | + .mockImplementation((content?: string | Element | Text): void => null); |
| 50 | + public setOptions = jest |
| 51 | + .fn() |
| 52 | + .mockImplementation( |
| 53 | + (options?: google.maps.InfoWindowOptions): void => null |
| 54 | + ); |
| 55 | + public setPosition = jest |
| 56 | + .fn() |
| 57 | + .mockImplementation( |
| 58 | + (position?: google.maps.LatLng | google.maps.LatLngLiteral): void => null |
| 59 | + ); |
| 60 | + public setZIndex = jest |
| 61 | + .fn() |
| 62 | + .mockImplementation((zIndex?: number): void => null); |
| 63 | + constructor(opts?: google.maps.InfoWindowOptions) { |
| 64 | + super(); |
| 65 | + } |
| 66 | +} |
0 commit comments