mirror of
https://github.com/element-hq/element-web
synced 2024-11-23 09:46:09 +03:00
Move map attribution to top right (#8621)
Signed-off-by: Michael Weimann <michaelw@matrix.org> Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
764b307e63
commit
1535ff0d6c
8 changed files with 71 additions and 13 deletions
|
@ -36,7 +36,9 @@ export const createMap = (
|
|||
style: styleUrl,
|
||||
zoom: 15,
|
||||
interactive,
|
||||
attributionControl: false,
|
||||
});
|
||||
map.addControl(new maplibregl.AttributionControl(), 'top-right');
|
||||
|
||||
map.on('error', (e) => {
|
||||
logger.error(
|
||||
|
|
|
@ -89,6 +89,10 @@ describe('<BeaconViewDialog />', () => {
|
|||
const getComponent = (props = {}) =>
|
||||
mount(<BeaconViewDialog {...defaultProps} {...props} />);
|
||||
|
||||
beforeAll(() => {
|
||||
maplibregl.AttributionControl = jest.fn();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
jest.spyOn(OwnBeaconStore.instance, 'getLiveBeaconIds').mockRestore();
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ import React from 'react';
|
|||
import { mount } from 'enzyme';
|
||||
import { RoomMember } from 'matrix-js-sdk/src/matrix';
|
||||
import { LocationAssetType } from 'matrix-js-sdk/src/@types/location';
|
||||
import maplibregl from 'maplibre-gl';
|
||||
|
||||
import LocationViewDialog from '../../../../src/components/views/location/LocationViewDialog';
|
||||
import { TILE_SERVER_WK_KEY } from '../../../../src/utils/WellKnownUtils';
|
||||
|
@ -41,6 +42,10 @@ describe('<LocationViewDialog />', () => {
|
|||
const getComponent = (props = {}) =>
|
||||
mount(<LocationViewDialog {...defaultProps} {...props} />);
|
||||
|
||||
beforeAll(() => {
|
||||
maplibregl.AttributionControl = jest.fn();
|
||||
});
|
||||
|
||||
it('renders map correctly', () => {
|
||||
const component = getComponent();
|
||||
expect(component.find('Map')).toMatchSnapshot();
|
||||
|
|
|
@ -44,6 +44,10 @@ describe('<Map />', () => {
|
|||
wrappingComponentProps: { value: matrixClient },
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
maplibregl.AttributionControl = jest.fn();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
matrixClient.getClientWellKnown.mockReturnValue({
|
||||
|
|
|
@ -23,7 +23,20 @@ exports[`<LocationViewDialog /> renders map correctly 1`] = `
|
|||
},
|
||||
"_eventsCount": 1,
|
||||
"_maxListeners": undefined,
|
||||
"addControl": [MockFunction],
|
||||
"addControl": [MockFunction] {
|
||||
"calls": Array [
|
||||
Array [
|
||||
mockConstructor {},
|
||||
"top-right",
|
||||
],
|
||||
],
|
||||
"results": Array [
|
||||
Object {
|
||||
"type": "return",
|
||||
"value": undefined,
|
||||
},
|
||||
],
|
||||
},
|
||||
"fitBounds": [MockFunction],
|
||||
"removeControl": [MockFunction],
|
||||
"setCenter": [MockFunction] {
|
||||
|
@ -78,7 +91,20 @@ exports[`<LocationViewDialog /> renders map correctly 1`] = `
|
|||
},
|
||||
"_eventsCount": 1,
|
||||
"_maxListeners": undefined,
|
||||
"addControl": [MockFunction],
|
||||
"addControl": [MockFunction] {
|
||||
"calls": Array [
|
||||
Array [
|
||||
mockConstructor {},
|
||||
"top-right",
|
||||
],
|
||||
],
|
||||
"results": Array [
|
||||
Object {
|
||||
"type": "return",
|
||||
"value": undefined,
|
||||
},
|
||||
],
|
||||
},
|
||||
"fitBounds": [MockFunction],
|
||||
"removeControl": [MockFunction],
|
||||
"setCenter": [MockFunction] {
|
||||
|
|
|
@ -79,6 +79,11 @@ describe('<MBeaconBody />', () => {
|
|||
});
|
||||
|
||||
const modalSpy = jest.spyOn(Modal, 'createTrackedDialog').mockReturnValue(undefined);
|
||||
|
||||
beforeAll(() => {
|
||||
maplibregl.AttributionControl = jest.fn();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
|
|
@ -56,6 +56,15 @@ describe("MLocationBody", () => {
|
|||
wrappingComponent: MatrixClientContext.Provider,
|
||||
wrappingComponentProps: { value: mockClient },
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
maplibregl.AttributionControl = jest.fn();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
describe('with error', () => {
|
||||
let sdkConfigSpy;
|
||||
|
||||
|
|
|
@ -124,7 +124,20 @@ exports[`MLocationBody <MLocationBody> without error renders map correctly 1`] =
|
|||
},
|
||||
"_eventsCount": 1,
|
||||
"_maxListeners": undefined,
|
||||
"addControl": [MockFunction],
|
||||
"addControl": [MockFunction] {
|
||||
"calls": Array [
|
||||
Array [
|
||||
mockConstructor {},
|
||||
"top-right",
|
||||
],
|
||||
],
|
||||
"results": Array [
|
||||
Object {
|
||||
"type": "return",
|
||||
"value": undefined,
|
||||
},
|
||||
],
|
||||
},
|
||||
"fitBounds": [MockFunction],
|
||||
"removeControl": [MockFunction],
|
||||
"setCenter": [MockFunction] {
|
||||
|
@ -135,22 +148,12 @@ exports[`MLocationBody <MLocationBody> without error renders map correctly 1`] =
|
|||
"lon": -0.1276,
|
||||
},
|
||||
],
|
||||
Array [
|
||||
Object {
|
||||
"lat": 51.5076,
|
||||
"lon": -0.1276,
|
||||
},
|
||||
],
|
||||
],
|
||||
"results": Array [
|
||||
Object {
|
||||
"type": "return",
|
||||
"value": undefined,
|
||||
},
|
||||
Object {
|
||||
"type": "return",
|
||||
"value": undefined,
|
||||
},
|
||||
],
|
||||
},
|
||||
"setStyle": [MockFunction],
|
||||
|
|
Loading…
Reference in a new issue