1ad25e30f8
新增 PlatformUiKit 通用弹窗、按钮、状态、空态、媒体、表单和标签等公共组件 迁移结果页、创作工作台、认证入口、RPG 暗色面板和运行态弹窗的重复 UI chrome 补充组件测试、页面回归测试、技术文档和 Hermes 共享决策记录
47 lines
1.3 KiB
TypeScript
47 lines
1.3 KiB
TypeScript
/* @vitest-environment jsdom */
|
|
|
|
import { render, screen } from '@testing-library/react';
|
|
import { expect, test } from 'vitest';
|
|
|
|
import { PlatformSlotBadge } from './PlatformSlotBadge';
|
|
|
|
test('renders an inactive compact slot badge by default', () => {
|
|
render(<PlatformSlotBadge>2</PlatformSlotBadge>);
|
|
|
|
const badge = screen.getByText('2');
|
|
|
|
expect(badge.className).toContain('h-5');
|
|
expect(badge.className).toContain('min-w-5');
|
|
expect(badge.className).toContain('rounded-full');
|
|
expect(badge.className).toContain('bg-zinc-900');
|
|
});
|
|
|
|
test('supports active slot badge and custom class', () => {
|
|
render(
|
|
<PlatformSlotBadge tone="active" className="custom-slot">
|
|
主
|
|
</PlatformSlotBadge>,
|
|
);
|
|
|
|
const badge = screen.getByText('主');
|
|
|
|
expect(badge.className).toContain('bg-sky-300');
|
|
expect(badge.className).toContain('text-slate-950');
|
|
expect(badge.className).toContain('custom-slot');
|
|
});
|
|
|
|
test('supports soft medium step badge', () => {
|
|
render(
|
|
<PlatformSlotBadge tone="soft" size="md">
|
|
1
|
|
</PlatformSlotBadge>,
|
|
);
|
|
|
|
const badge = screen.getByText('1');
|
|
|
|
expect(badge.className).toContain('h-6');
|
|
expect(badge.className).toContain('min-w-6');
|
|
expect(badge.className).toContain('bg-white/82');
|
|
expect(badge.className).toContain('shadow-sm');
|
|
});
|