feat: unify creation entry templates

This commit is contained in:
2026-06-03 10:24:03 +08:00
parent b0865cfa19
commit 3f742fbaca
25 changed files with 820 additions and 346 deletions

View File

@@ -3752,14 +3752,14 @@ test('create tab shows template tabs and embeds puzzle form by default', async (
expect(createPuzzleAgentSession).not.toHaveBeenCalled();
});
test('create tab shows recent tab when backend returns failed drafts', async () => {
test('create tab shows recent template cards when backend returns failed drafts', async () => {
const user = userEvent.setup();
mockExistingRpgDraftShelf({
title: '入口可见的失败草稿',
summary: '失败草稿也要进入创作入口最近创作。',
stage: 'failed',
stageLabel: '生成失败待处理',
updatedAt: '2026-06-02T10:00:00.000Z',
updatedAt: new Date(Date.now() - 24 * 60 * 60 * 1000).toISOString(),
});
render(<TestWrapper withAuth />);
@@ -3775,11 +3775,18 @@ test('create tab shows recent tab when backend returns failed drafts', async ()
.getByRole('tab', { name: '最近创作' })
.getAttribute('aria-selected'),
).toBe('true');
expect(await within(panel).findByText('入口可见的失败草稿')).toBeTruthy();
expect(
within(panel).getByText('失败草稿也要进入创作入口最近创作。'),
await within(panel).findByRole('button', { name: /文字冒险/u }),
).toBeTruthy();
expect(within(panel).getByText('生成失败待处理')).toBeTruthy();
expect(
within(panel).getByText('仅显示最近7天内使用过的模板'),
).toBeTruthy();
expect(within(panel).getByText('经典 RPG 体验')).toBeTruthy();
expect(within(panel).queryByText('入口可见的失败草稿')).toBeNull();
expect(
within(panel).queryByText('失败草稿也要进入创作入口最近创作。'),
).toBeNull();
expect(within(panel).queryByText('生成失败待处理')).toBeNull();
});
test('create tab refreshes recent works after opening from an empty draft shelf', async () => {
@@ -3789,7 +3796,7 @@ test('create tab refreshes recent works after opening from an empty draft shelf'
summary: '创作入口需要在进入时重新读取真实作品架。',
stage: 'error',
stageLabel: '发生错误',
updatedAt: '2026-06-02T10:30:00.000Z',
updatedAt: new Date(Date.now() - 24 * 60 * 60 * 1000).toISOString(),
});
vi.mocked(listRpgCreationWorks)
.mockResolvedValueOnce([])
@@ -3803,11 +3810,18 @@ test('create tab refreshes recent works after opening from an empty draft shelf'
await clickFirstButtonByName(user, '创作');
const panel = getPlatformTabPanel('create');
expect(await within(panel).findByText('点击创作后出现的失败草稿')).toBeTruthy();
expect(
within(panel).getByText('创作入口需要在进入时重新读取真实作品架。'),
await within(panel).findByRole('button', { name: /文字冒险/u }),
).toBeTruthy();
expect(within(panel).getByText('发生错误')).toBeTruthy();
expect(
within(panel).getByText('仅显示最近7天内使用过的模板'),
).toBeTruthy();
expect(within(panel).getByText('经典 RPG 体验')).toBeTruthy();
expect(within(panel).queryByText('点击创作后出现的失败草稿')).toBeNull();
expect(
within(panel).queryByText('创作入口需要在进入时重新读取真实作品架。'),
).toBeNull();
expect(within(panel).queryByText('发生错误')).toBeNull();
await waitFor(() => {
expect(
vi.mocked(listRpgCreationWorks).mock.calls.length,