import type { FC } from 'react' import { fireEvent, screen } from '@testing-library/react' import { beforeEach, describe, expect, it, vi } from 'vitest' import { render } from '@/test/console/render' import { CommentInput } from './comment-input' type MentionInputProps = { value: string onChange: (value: string) => void onSubmit: (content: string, mentionedUserIds: string[]) => void placeholder?: string disabled?: boolean autoFocus?: boolean className?: string } const stableT = (key: string, options?: { ns?: string }) => options?.ns ? `${options.ns}.${key}` : key let mentionInputProps: MentionInputProps | null = null const mockConsoleState = vi.hoisted(() => ({ userProfile: { id: 'user-1', name: 'Alice', avatar_url: 'avatar', }, })) vi.mock('react-i18next', async () => { const { withSelectorKey } = await import('@/test/i18n-mock') return { useTranslation: () => ({ t: withSelectorKey(stableT), }), } }) vi.mock('@/context/account-state', async () => { const { createAccountStateModuleMock } = await import('@/test/console/state-fixture') return createAccountStateModuleMock(() => mockConsoleState) }) vi.mock('@langgenius/dify-ui/avatar', () => ({ Avatar: ({ name }: { name: string }) =>