diff --git a/res/css/components/views/location/_ShareType.scss b/res/css/components/views/location/_ShareType.scss index b8fa1d6b4510..3d82ae2e33a5 100644 --- a/res/css/components/views/location/_ShareType.scss +++ b/res/css/components/views/location/_ShareType.scss @@ -1,3 +1,18 @@ +/* +Copyright 2022 The Matrix.org Foundation C.I.C. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ .mx_ShareType { flex: 1; @@ -34,7 +49,7 @@ justify-content: flex-start; padding: $spacing-8 $spacing-20; margin-top: $spacing-12; - + color: $primary-content; border: 1px solid $quinary-content; border-radius: 8px; diff --git a/src/components/views/location/ShareType.tsx b/src/components/views/location/ShareType.tsx index bb3a24af284f..778f1309e16e 100644 --- a/src/components/views/location/ShareType.tsx +++ b/src/components/views/location/ShareType.tsx @@ -21,6 +21,7 @@ import { _t } from '../../../languageHandler'; import { OwnProfileStore } from '../../../stores/OwnProfileStore'; import { getUserNameColorClass } from '../../../utils/FormattingUtils'; import BaseAvatar from '../avatars/BaseAvatar'; +import AccessibleButton from '../elements/AccessibleButton'; import Heading from '../typography/Heading'; const UserAvatar = () => { @@ -55,7 +56,8 @@ export enum LocationShareType { type ShareTypeOptionProps = HTMLAttributes & { label: string, shareType: LocationShareType }; const ShareTypeOption: React.FC = ({ onClick, label, shareType, ...rest -}) => ; +; interface Props { setShareType: (shareType: LocationShareType) => void; diff --git a/test/components/views/location/LocationShareMenu-test.tsx b/test/components/views/location/LocationShareMenu-test.tsx index 47fc4c5a8c8a..5652bfabc74d 100644 --- a/test/components/views/location/LocationShareMenu-test.tsx +++ b/test/components/views/location/LocationShareMenu-test.tsx @@ -29,6 +29,10 @@ import { MatrixClientPeg } from '../../../../src/MatrixClientPeg'; import { LocationShareType } from '../../../../src/components/views/location/ShareType'; import { findByTestId } from '../../../test-utils'; +jest.mock('../../../../src/components/views/messages/MLocationBody', () => ({ + findMapStyleUrl: jest.fn().mockReturnValue('test'), +})); + jest.mock('../../../../src/settings/SettingsStore', () => ({ getValue: jest.fn(), monitorSetting: jest.fn(), @@ -47,6 +51,7 @@ describe('', () => { const userId = '@ernie:server.org'; const mockClient = { on: jest.fn(), + removeListener: jest.fn(), getUserId: jest.fn().mockReturnValue(userId), getClientWellKnown: jest.fn().mockResolvedValue({ map_style_url: 'maps.com', diff --git a/test/components/views/location/ShareType-test.tsx b/test/components/views/location/ShareType-test.tsx deleted file mode 100644 index aa9124278d0e..000000000000 --- a/test/components/views/location/ShareType-test.tsx +++ /dev/null @@ -1,45 +0,0 @@ - -import React from 'react'; -import { mount } from 'enzyme'; - -import '../../../skinned-sdk'; -import ShareType, { LocationShareType } from '../../../../src/components/views/location/ShareType'; -import MatrixClientContext from '../../../../src/contexts/MatrixClientContext'; - -jest.mock('../../../../src/stores/OwnProfileStore', () => ({ - OwnProfileStore: { - instance: { - displayName: 'Ernie', - getHttpAvatarUrl: jest.fn().mockReturnValue('image.com/img'), - }, - }, -})); - -describe('', () => { - const userId = '@ernie:server.org'; - const mockClient = { - on: jest.fn(), - getUserId: jest.fn().mockReturnValue(userId), - getClientWellKnown: jest.fn().mockResolvedValue({ - map_style_url: 'maps.com', - }), - }; - - const defaultProps = { - setShareType: jest.fn(), - enabledShareTypes: [ - LocationShareType.Own, - LocationShareType.Pin, - ], - }; - const getComponent = (props = {}) => - mount(, { - wrappingComponent: MatrixClientContext.Provider, - wrappingComponentProps: { value: mockClient }, - }); - - it('renders', () => { - const component = getComponent(); - expect(component).toBeTruthy(); - }); -}); diff --git a/test/components/views/location/__snapshots__/LocationShareMenu-test.tsx.snap b/test/components/views/location/__snapshots__/LocationShareMenu-test.tsx.snap deleted file mode 100644 index 130496e66834..000000000000 --- a/test/components/views/location/__snapshots__/LocationShareMenu-test.tsx.snap +++ /dev/null @@ -1,289 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[` renders 1`] = ` - - - -
-
-
-
-
-
-
-
- Failed to load map -
- -
-
- - -
-
-
-
-
-
-
-
- } - > - -
-
-
-
-
- -
-
-
- Failed to load map -
-
-
- -
- - -
-
-
-
-
-
- - - - - - -
-
-
-
- -
-
-
- - - - -`;