Files
Genarrative/src/components/common/PlatformAcknowledgeStatusDialog.test.tsx
kdletters edf37d97a7 收口单按钮已读状态弹窗
新增 PlatformAcknowledgeStatusDialog 统一承接单按钮已读状态壳层
迁移大鱼结果页与个人中心支付结果复用共享已读状态弹窗
迁移 RPG 编辑器与平台入口提示链路复用共享已读状态弹窗
迁移自定义世界实体目录阻断提示复用共享已读状态弹窗
补充共享组件测试并更新 PlatformUiKit 收口文档与决策记录
2026-06-11 00:38:26 +08:00

49 lines
1.4 KiB
TypeScript

/* @vitest-environment jsdom */
import { fireEvent, render, screen } from '@testing-library/react';
import { expect, test, vi } from 'vitest';
import { PlatformAcknowledgeStatusDialog } from './PlatformAcknowledgeStatusDialog';
test('renders a standard acknowledge action and closes through 知道了', () => {
const onClose = vi.fn();
render(
<PlatformAcknowledgeStatusDialog
status="error"
title="提示"
description="至少保留一个可扮演角色。"
onClose={onClose}
/>,
);
const action = screen.getByRole('button', { name: '知道了' });
expect(action.className).toContain('platform-button');
fireEvent.click(action);
expect(onClose).toHaveBeenCalledTimes(1);
});
test('supports custom action styling and header notice layout', () => {
render(
<PlatformAcknowledgeStatusDialog
status="error"
title="发布失败"
description="还缺少 16 个基础动作"
onClose={() => {}}
showHeader
showCloseButton
closeOnBackdrop
iconLabel="发布失败提示"
actionClassName="border-slate-950 bg-slate-950 text-white"
/>,
);
const action = screen.getByRole('button', { name: '知道了' });
const dialog = screen.getByRole('dialog', { name: '发布失败' });
expect(action.className).toContain('border-slate-950');
expect(action.className).toContain('bg-slate-950');
expect(dialog.querySelector('[aria-label="发布失败提示"]')).toBeTruthy();
});