mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-16 21:24:59 +08:00
f70186ea9b
* open a dialog with map centered around first beacon Signed-off-by: Kerry Archibald <kerrya@element.io> * test dialog opening from beacon body Signed-off-by: Kerry Archibald <kerrya@element.io> * test beaconmarker Signed-off-by: Kerry Archibald <kerrya@element.io> * add bounds to Map comp Signed-off-by: Kerry Archibald <kerrya@element.io> * add focusBeacon to beaconviewdialog, use bounds Signed-off-by: Kerry Archibald <kerrya@element.io> * lint Signed-off-by: Kerry Archibald <kerrya@element.io> * use membercolor on beacon view markers Signed-off-by: Kerry Archibald <kerrya@element.io> * add lnglatbounds to maplibre mock Signed-off-by: Kerry Archibald <kerrya@element.io> * update snapshots for expanded maplibre Map mock Signed-off-by: Kerry Archibald <kerrya@element.io> * test map bounds Signed-off-by: Kerry Archibald <kerrya@element.io> * tidy copy paste comment Signed-off-by: Kerry Archibald <kerrya@element.io> * add fallback when no more live locations Signed-off-by: Kerry Archibald <kerrya@element.io> * accurate signature for getBoundsCenter Signed-off-by: Kerry Archibald <kerrya@element.io>
31 lines
971 B
JavaScript
31 lines
971 B
JavaScript
const EventEmitter = require("events");
|
|
const { LngLat, NavigationControl, LngLatBounds } = require('maplibre-gl');
|
|
|
|
class MockMap extends EventEmitter {
|
|
addControl = jest.fn();
|
|
removeControl = jest.fn();
|
|
zoomIn = jest.fn();
|
|
zoomOut = jest.fn();
|
|
setCenter = jest.fn();
|
|
setStyle = jest.fn();
|
|
fitBounds = jest.fn();
|
|
}
|
|
const MockMapInstance = new MockMap();
|
|
|
|
class MockGeolocateControl extends EventEmitter {
|
|
trigger = jest.fn();
|
|
}
|
|
const MockGeolocateInstance = new MockGeolocateControl();
|
|
const MockMarker = {}
|
|
MockMarker.setLngLat = jest.fn().mockReturnValue(MockMarker);
|
|
MockMarker.addTo = jest.fn().mockReturnValue(MockMarker);
|
|
MockMarker.remove = jest.fn().mockReturnValue(MockMarker);
|
|
module.exports = {
|
|
Map: jest.fn().mockReturnValue(MockMapInstance),
|
|
GeolocateControl: jest.fn().mockReturnValue(MockGeolocateInstance),
|
|
Marker: jest.fn().mockReturnValue(MockMarker),
|
|
LngLat,
|
|
LngLatBounds,
|
|
NavigationControl,
|
|
};
|