diff options
Diffstat (limited to 'src/components/organisms/comment')
| -rw-r--r-- | src/components/organisms/comment/approved-comment/approved-comment.test.tsx | 3 | ||||
| -rw-r--r-- | src/components/organisms/comment/approved-comment/approved-comment.tsx | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/components/organisms/comment/approved-comment/approved-comment.test.tsx b/src/components/organisms/comment/approved-comment/approved-comment.test.tsx index b244a63..473f845 100644 --- a/src/components/organisms/comment/approved-comment/approved-comment.test.tsx +++ b/src/components/organisms/comment/approved-comment/approved-comment.test.tsx @@ -1,6 +1,7 @@ import { describe, expect, it } from '@jest/globals'; import { userEvent } from '@testing-library/user-event'; import { render, screen as rtlScreen } from '../../../../../tests/utils'; +import { COMMENT_ID_PREFIX } from '../../../../utils/constants'; import { ApprovedComment, type CommentAuthor } from './approved-comment'; describe('ApprovedComment', () => { @@ -30,7 +31,7 @@ describe('ApprovedComment', () => { ).toBeInTheDocument(); expect(rtlScreen.getByRole('link')).toHaveAttribute( 'href', - `#comment-${id}` + `#${COMMENT_ID_PREFIX}${id}` ); }); diff --git a/src/components/organisms/comment/approved-comment/approved-comment.tsx b/src/components/organisms/comment/approved-comment/approved-comment.tsx index d834ba3..6611c11 100644 --- a/src/components/organisms/comment/approved-comment/approved-comment.tsx +++ b/src/components/organisms/comment/approved-comment/approved-comment.tsx @@ -1,6 +1,7 @@ import NextImage from 'next/image'; import { type ForwardRefRenderFunction, forwardRef, useCallback } from 'react'; import { useIntl } from 'react-intl'; +import { COMMENT_ID_PREFIX } from '../../../../utils/constants'; import { Button, Link, Time } from '../../../atoms'; import { Card, @@ -99,7 +100,7 @@ const ApprovedCommentWithRef: ForwardRefRenderFunction< ) => { const intl = useIntl(); const commentClass = `${className}`; - const commentId = `comment-${id}`; + const commentId = `${COMMENT_ID_PREFIX}${id}`; const commentLink = `#${commentId}`; const publicationDateLabel = intl.formatMessage({ defaultMessage: 'Published on:', |
