From befb0792076ea58dba23e34524e58af80c648bfe Mon Sep 17 00:00:00 2001 From: Pavel Mineev Date: Wed, 28 Apr 2021 22:05:10 +0300 Subject: [PATCH] fix default avatar - fix import of default avatar - optimaze ghost svg - add tests - refactor avatar-icon --- .../avatar-icon/avatar-icon.spec.tsx | 12 ++++++++++++ .../components/avatar-icon/avatar-icon.svg | 19 +++---------------- .../components/avatar-icon/avatar-icon.tsx | 11 ++++++----- 3 files changed, 21 insertions(+), 21 deletions(-) create mode 100644 frontend/app/components/avatar-icon/avatar-icon.spec.tsx diff --git a/frontend/app/components/avatar-icon/avatar-icon.spec.tsx b/frontend/app/components/avatar-icon/avatar-icon.spec.tsx new file mode 100644 index 00000000..af4f526f --- /dev/null +++ b/frontend/app/components/avatar-icon/avatar-icon.spec.tsx @@ -0,0 +1,12 @@ +import '@testing-library/jest-dom'; +import { h } from 'preact'; +import { render } from '@testing-library/preact'; +import { AvatarIcon } from './avatar-icon'; + +describe('', () => { + it('should get', () => { + const { getByAltText } = render(); + + expect(getByAltText('avatar')).toHaveAttribute('src', 'https://url-to-svg-image'); + }); +}); diff --git a/frontend/app/components/avatar-icon/avatar-icon.svg b/frontend/app/components/avatar-icon/avatar-icon.svg index 768b8b70..6004f60d 100644 --- a/frontend/app/components/avatar-icon/avatar-icon.svg +++ b/frontend/app/components/avatar-icon/avatar-icon.svg @@ -1,18 +1,5 @@ - - - - - - - - - - - - - - + + + diff --git a/frontend/app/components/avatar-icon/avatar-icon.tsx b/frontend/app/components/avatar-icon/avatar-icon.tsx index 57c7e344..0cca7df8 100644 --- a/frontend/app/components/avatar-icon/avatar-icon.tsx +++ b/frontend/app/components/avatar-icon/avatar-icon.tsx @@ -2,18 +2,19 @@ import { h, JSX } from 'preact'; import b from 'bem-react-helper'; import { Theme } from 'common/types'; -interface Props { +type Props = JSX.HTMLAttributes & { picture?: string; mix?: string; theme?: Theme; -} +}; -export function AvatarIcon(props: Props & JSX.HTMLAttributes) { +export function AvatarIcon({ mix, theme, picture, ...props }: Props) { return ( ); }