扩展状态弹窗承接提示类 notice

扩展 PlatformStatusDialog 支持标题栏提示与关闭路径
PlatformEntryFlowShellImpl 改用共享状态弹窗承接泥点提示与作品不可用提示
RpgCreationEntityEditorShared 改用共享状态弹窗承接编辑器提示
补充状态弹窗与编辑器提示测试并更新文档记录
This commit is contained in:
2026-06-10 20:52:34 +08:00
parent 547e771f75
commit a076faf652
7 changed files with 127 additions and 25 deletions

View File

@@ -2,6 +2,7 @@
import {
cleanup,
fireEvent,
render,
screen,
waitFor,
@@ -857,11 +858,15 @@ test('可扮演角色至少保留一个背景章节时使用统一提示弹窗',
await user.click(deleteChapterButtons()[0]!);
const dialog = await screen.findByRole('dialog', { name: '提示' });
const actionButton = within(dialog).getByRole('button', { name: '知道了' });
expect(within(dialog).getByText('至少保留一个背景章节。')).toBeTruthy();
expect(dialog.querySelector('.platform-icon-badge')).toBeTruthy();
expect(actionButton.className).toContain('platform-button');
expect(alertSpy).not.toHaveBeenCalled();
expect(screen.getByText('编辑角色:沈砺')).toBeTruthy();
await user.click(within(dialog).getByRole('button', { name: '知道了' }));
await user.click(actionButton);
await waitFor(() => {
expect(screen.queryByRole('dialog', { name: '提示' })).toBeNull();
});
@@ -1798,12 +1803,15 @@ test('场景连接缺少可连接目标时使用统一提示弹窗', async () =>
await user.click(screen.getByText('北'));
const dialog = await screen.findByRole('dialog', { name: '提示' });
const overlay = dialog.parentElement as HTMLElement;
expect(
within(dialog).getByText('请先保留至少一个其他场景,才能配置连接关系。'),
).toBeTruthy();
expect(overlay.className).toContain('rpg-editor-notice-dialog-overlay');
expect(alertSpy).not.toHaveBeenCalled();
await user.click(within(dialog).getByRole('button', { name: '知道了' }));
fireEvent.click(overlay);
await waitFor(() => {
expect(screen.queryByRole('dialog', { name: '提示' })).toBeNull();
});
@@ -2000,6 +2008,11 @@ test('场景保存缺少主角色时使用统一提示弹窗', async () => {
expect(alertSpy).not.toHaveBeenCalled();
expect(screen.getByText('编辑场景:空港栈桥')).toBeTruthy();
fireEvent.keyDown(window, { key: 'Escape' });
await waitFor(() => {
expect(screen.queryByRole('dialog', { name: '提示' })).toBeNull();
});
alertSpy.mockRestore();
});