继续沉淀工具信息弹窗与个人中心内容骨架
新增PlatformUtilityInfoModal统一工具信息弹窗白底骨架 收口profile副弹层的摘要头列表骨架与内容行 同步更新PlatformUiKit收口计划与共享决策记录
This commit is contained in:
51
src/components/common/PlatformUtilityInfoModal.test.tsx
Normal file
51
src/components/common/PlatformUtilityInfoModal.test.tsx
Normal file
@@ -0,0 +1,51 @@
|
||||
/* @vitest-environment jsdom */
|
||||
|
||||
import { render, screen, within } from '@testing-library/react';
|
||||
import { expect, test } from 'vitest';
|
||||
|
||||
import { PlatformUtilityInfoModal } from './PlatformUtilityInfoModal';
|
||||
|
||||
test('renders platform utility info modal shell with default platform styling', () => {
|
||||
render(
|
||||
<PlatformUtilityInfoModal
|
||||
open
|
||||
title="工具信息"
|
||||
onClose={() => {}}
|
||||
footer={<button type="button">知道了</button>}
|
||||
panelClassName="rounded-[1.5rem]"
|
||||
>
|
||||
<div>这里是正文</div>
|
||||
</PlatformUtilityInfoModal>,
|
||||
);
|
||||
|
||||
const dialog = screen.getByRole('dialog', { name: '工具信息' });
|
||||
expect(dialog.parentElement?.className).toContain('platform-theme--light');
|
||||
expect(dialog.parentElement?.className).toContain('!items-center');
|
||||
expect(dialog.className).toContain('platform-remap-surface');
|
||||
expect(dialog.className).toContain('rounded-[1.5rem]');
|
||||
expect(within(dialog).getByText('这里是正文')).toBeTruthy();
|
||||
expect(within(dialog).getByRole('button', { name: '知道了' })).toBeTruthy();
|
||||
});
|
||||
|
||||
test('supports custom theme and spacing overrides', () => {
|
||||
render(
|
||||
<PlatformUtilityInfoModal
|
||||
open
|
||||
title="工具信息"
|
||||
onClose={() => {}}
|
||||
platformTheme="dark"
|
||||
bodyClassName="space-y-3"
|
||||
footerClassName="justify-center pt-0"
|
||||
footer={<button type="button">继续</button>}
|
||||
>
|
||||
<div>这里是正文</div>
|
||||
</PlatformUtilityInfoModal>,
|
||||
);
|
||||
|
||||
const dialog = screen.getByRole('dialog', { name: '工具信息' });
|
||||
expect(dialog.parentElement?.className).toContain('platform-theme--dark');
|
||||
expect(dialog.querySelector('.space-y-3')).toBeTruthy();
|
||||
expect(dialog.querySelector('.justify-center')).toBeTruthy();
|
||||
expect(dialog.querySelector('.pt-0')).toBeTruthy();
|
||||
expect(within(dialog).getByRole('button', { name: '继续' })).toBeTruthy();
|
||||
});
|
||||
Reference in New Issue
Block a user