新增 PlatformUiKit 通用弹窗、按钮、状态、空态、媒体、表单和标签等公共组件 迁移结果页、创作工作台、认证入口、RPG 暗色面板和运行态弹窗的重复 UI chrome 补充组件测试、页面回归测试、技术文档和 Hermes 共享决策记录
32 lines
931 B
TypeScript
32 lines
931 B
TypeScript
/* @vitest-environment jsdom */
|
|
|
|
import { render, screen } from '@testing-library/react';
|
|
import { expect, test } from 'vitest';
|
|
|
|
import { PlatformQuantityBadge } from './PlatformQuantityBadge';
|
|
|
|
test('renders a dark bottom-right quantity badge by default', () => {
|
|
render(<PlatformQuantityBadge>3</PlatformQuantityBadge>);
|
|
|
|
const badge = screen.getByText('3');
|
|
|
|
expect(badge.className).toContain('absolute');
|
|
expect(badge.className).toContain('bottom-1');
|
|
expect(badge.className).toContain('right-1');
|
|
expect(badge.className).toContain('bg-black/70');
|
|
expect(badge.className).toContain('text-[10px]');
|
|
});
|
|
|
|
test('supports custom class names', () => {
|
|
render(
|
|
<PlatformQuantityBadge className="custom-quantity">
|
|
12
|
|
</PlatformQuantityBadge>,
|
|
);
|
|
|
|
const badge = screen.getByText('12');
|
|
|
|
expect(badge.className).toContain('rounded-full');
|
|
expect(badge.className).toContain('custom-quantity');
|
|
});
|