e6b3199490
之前遇到几次弹窗的样式不生效,bug 现在在画布agent的删除对话弹窗又出现了, 这个pr把类似的修改集中到最下层的UnifiedModal,适用于所有的modal, 一些特殊的modal有特殊处理. 画布agent的删除对话弹窗  --------- Co-authored-by: 段舒康 <kdletters@qq.com> Reviewed-on: http://192.168.35.82/git/GenarrativeAI/Genarrative/pulls/122 Reviewed-by: 段舒康 <kdletters@qq.com> Co-authored-by: 王德宇 <kvtodev@outlook.com> Co-committed-by: 王德宇 <kvtodev@outlook.com>
56 lines
1.9 KiB
TypeScript
56 lines
1.9 KiB
TypeScript
/* @vitest-environment jsdom */
|
|
|
|
import { render, screen, within } from '@testing-library/react';
|
|
import { expect, test, vi } from 'vitest';
|
|
|
|
import { PlatformUtilityInfoModal } from './PlatformUtilityInfoModal';
|
|
|
|
vi.mock('../auth/AuthUiContext', () => ({
|
|
useAuthUi: () => ({ platformTheme: 'dark' }),
|
|
}));
|
|
|
|
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--dark');
|
|
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();
|
|
});
|