This commit is contained in:
2026-04-23 03:51:14 +08:00
parent 1223f597d2
commit 8530cd0d8e
11 changed files with 241 additions and 54 deletions

View File

@@ -443,7 +443,7 @@ test('readOnly result view hides edit and create actions for agent preview mode'
expect(screen.queryByRole('button', { name: //u })).toBeNull();
});
test('agent result view shows publish blockers and disables publish-enter action', () => {
test('agent result view keeps publish-enter action clickable and hides sticky publish hints', () => {
render(
<RpgCreationResultView
profile={baseProfile}
@@ -474,15 +474,48 @@ test('agent result view shows publish blockers and disables publish-enter action
/>,
);
expect(screen.getByText(//u)).toBeTruthy();
expect(screen.getByText(/ 2 /u)).toBeTruthy();
expect(
screen.getByText(//u),
).toBeTruthy();
const actionButton = screen.getByRole('button', {
name: '发布并进入世界',
});
expect((actionButton as HTMLButtonElement).disabled).toBe(true);
expect((actionButton as HTMLButtonElement).disabled).toBe(false);
expect(screen.queryByText(//u)).toBeNull();
expect(screen.queryByText(/ 2 /u)).toBeNull();
});
test('agent result view opens publish blocker dialog only when user clicks publish action', async () => {
const user = userEvent.setup();
render(
<RpgCreationResultView
profile={baseProfile}
previewCharacters={[]}
isGenerating={false}
progress={0}
progressLabel=""
error={null}
onBack={() => {}}
onProfileChange={() => {}}
compactAgentResultMode
publishReady={false}
publishBlockers={[
'仍有角色缺少正式主图或动作资产,发布前需要先补齐。',
'营地还缺少正式场景图资产,发布前需要先确认营地图。',
]}
previewSourceLabel="服务端预览"
enterWorldActionLabel="发布并进入世界"
onEnterWorld={() => {}}
/>,
);
await user.click(screen.getByRole('button', { name: '发布并进入世界' }));
expect(
screen.getByRole('dialog', { name: '发布前检查' }),
).toBeTruthy();
expect(screen.getByText(/ 2 /u)).toBeTruthy();
expect(
screen.getByText(//u),
).toBeTruthy();
});
test('agent result view keeps publish-enter action enabled when publish gate is clear', () => {