d08842b576
新增PlatformUtilityInfoModal统一工具信息弹窗白底骨架 收口profile副弹层的摘要头列表骨架与内容行 同步更新PlatformUiKit收口计划与共享决策记录
52 lines
1.6 KiB
TypeScript
52 lines
1.6 KiB
TypeScript
/* @vitest-environment jsdom */
|
|
|
|
import { render, screen } from '@testing-library/react';
|
|
import userEvent from '@testing-library/user-event';
|
|
import { expect, test, vi } from 'vitest';
|
|
|
|
import { PlatformProfileContentRow } from './PlatformProfileContentRow';
|
|
import { PlatformProfileSkeletonList } from './PlatformProfileSkeletonList';
|
|
import { PlatformProfileSummaryHeader } from './PlatformProfileSummaryHeader';
|
|
|
|
test('platform profile summary header renders kicker, title and badge slot', () => {
|
|
render(
|
|
<PlatformProfileSummaryHeader
|
|
kicker="PLAYED"
|
|
title="玩过"
|
|
badge={<span>1.5小时</span>}
|
|
/>,
|
|
);
|
|
|
|
expect(screen.getByText('PLAYED')).toBeTruthy();
|
|
expect(screen.getByText('玩过')).toBeTruthy();
|
|
expect(screen.getByText('1.5小时')).toBeTruthy();
|
|
});
|
|
|
|
test('platform profile skeleton list renders requested skeleton rows', () => {
|
|
const { container } = render(
|
|
<PlatformProfileSkeletonList
|
|
count={3}
|
|
containerClassName="space-y-3"
|
|
itemClassName="h-16"
|
|
/>,
|
|
);
|
|
|
|
expect(container.querySelectorAll('.animate-pulse')).toHaveLength(3);
|
|
expect(container.querySelector('.space-y-3')).toBeTruthy();
|
|
expect(container.querySelector('.h-16')).toBeTruthy();
|
|
});
|
|
|
|
test('platform profile content row preserves interactive button semantics', async () => {
|
|
const user = userEvent.setup();
|
|
const onClick = vi.fn();
|
|
|
|
render(
|
|
<PlatformProfileContentRow as="button" onClick={onClick}>
|
|
点击行
|
|
</PlatformProfileContentRow>,
|
|
);
|
|
|
|
await user.click(screen.getByRole('button', { name: '点击行' }));
|
|
expect(onClick).toHaveBeenCalledTimes(1);
|
|
});
|