import { describe, expect, it } from 'vitest'; import { render, screen } from '@testing-library/react'; import EmptyPlaceholder from '@/components/EmptyPlaceholder'; describe('EmptyPlaceholder 组件', () => { it('应渲染字符串提示文本', () => { render(请输入内容); expect(screen.getByText('请输入内容')).toBeInTheDocument(); }); it('应应用规范空状态容器样式', () => { const { container } = render(提示); const placeholder = container.firstChild; expect(placeholder).toHaveClass( 'rounded-xl', 'bg-muted/30', 'border-dashed', 'border-border/80', 'min-h-[120px]', ); }); it('应支持 className 自定义容器样式', () => { const { container } = render( 提示, ); expect(container.firstChild).toHaveClass('flex-1', 'min-h-[320px]'); }); it('应支持 messageClassName 自定义文本样式', () => { render(提示); expect(screen.getByText('提示')).toHaveClass('text-sm', 'max-w-none'); }); it('应支持 ReactNode 类型的 children', () => { render( 自定义内容 , ); expect(screen.getByTestId('custom-content')).toBeInTheDocument(); }); });