diff --git a/frontend/app/components/avatar/avatar.spec.tsx b/frontend/app/components/avatar/avatar.spec.tsx index 76d3de5b..9ac51a52 100644 --- a/frontend/app/components/avatar/avatar.spec.tsx +++ b/frontend/app/components/avatar/avatar.spec.tsx @@ -7,10 +7,15 @@ import { BASE_URL } from 'common/constants.config'; import { Avatar } from './avatar'; describe('', () => { - it('should get', () => { - const { getByAltText } = render(); + it('should have correct url', () => { + const { container } = render(); - expect(getByAltText('avatar')).toHaveAttribute('src', `${BASE_URL}/image.svg`); - expect(getByAltText('avatar')).toHaveAttribute('alt', 'avatar'); + expect(container.querySelector('img')).toHaveAttribute('src', `${BASE_URL}/image.svg`); + }); + + it("shouldn't be accessible with screen reader", () => { + const { container } = render(); + + expect(container.querySelector('img')).toHaveAttribute('aria-hidden', 'true'); }); }); diff --git a/frontend/app/components/avatar/avatar.tsx b/frontend/app/components/avatar/avatar.tsx index 89b46265..d3f8e7c4 100644 --- a/frontend/app/components/avatar/avatar.tsx +++ b/frontend/app/components/avatar/avatar.tsx @@ -3,20 +3,24 @@ import { h } from 'preact'; import { BASE_URL } from 'common/constants.config'; +import ghostIconUrl from './assets/ghost.svg'; import styles from './avatar.module.css'; type Props = { url?: string; - alt: string; /** className should be used only in puprose of put permanent class on Avatar for user themization */ className: string; }; -export function Avatar({ url, className, alt }: Props) { - const avatarUrl = url || `${BASE_URL}${require('./assets/ghost.svg').default}`; +export function Avatar({ url, className }: Props) { + const avatarUrl = url || `${BASE_URL}${ghostIconUrl}`; return ( // eslint-disable-next-line jsx-a11y/alt-text - + ); } diff --git a/frontend/app/components/comment/comment.tsx b/frontend/app/components/comment/comment.tsx index 775f49fc..3ed409fa 100644 --- a/frontend/app/components/comment/comment.tsx +++ b/frontend/app/components/comment/comment.tsx @@ -660,9 +660,7 @@ export class Comment extends Component { )} - {props.view !== 'user' && !props.collapsed && ( - - )} + {props.view !== 'user' && !props.collapsed && } {props.view !== 'user' && ( { return ( - +