Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
lint and test
Browse files Browse the repository at this point in the history
Signed-off-by: Kerry Archibald <kerrya@element.io>
  • Loading branch information
Kerry Archibald committed Mar 2, 2022
1 parent 6884d61 commit 5153642
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 337 deletions.
17 changes: 16 additions & 1 deletion res/css/components/views/location/_ShareType.scss
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 4 additions & 2 deletions src/components/views/location/ShareType.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand Down Expand Up @@ -55,7 +56,8 @@ export enum LocationShareType {
type ShareTypeOptionProps = HTMLAttributes<HTMLButtonElement> & { label: string, shareType: LocationShareType };
const ShareTypeOption: React.FC<ShareTypeOptionProps> = ({
onClick, label, shareType, ...rest
}) => <button
}) => <AccessibleButton
element='button'
className='mx_ShareType_option'
onClick={onClick}
// not yet implemented
Expand All @@ -66,7 +68,7 @@ const ShareTypeOption: React.FC<ShareTypeOptionProps> = ({
{ shareType === LocationShareType.Pin && <LocationPinIcon /> }

{ label }
</button>;
</AccessibleButton>;

interface Props {
setShareType: (shareType: LocationShareType) => void;
Expand Down
5 changes: 5 additions & 0 deletions test/components/views/location/LocationShareMenu-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -47,6 +51,7 @@ describe('<LocationShareMenu />', () => {
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',
Expand Down
45 changes: 0 additions & 45 deletions test/components/views/location/ShareType-test.tsx

This file was deleted.

Loading

0 comments on commit 5153642

Please sign in to comment.