继续收口NPC弹窗与角色详情空态

统一 NPC 弹窗底部动作按钮与交易详情空态到共享组件
统一角色构筑详情空明细到 PlatformEmptyState
补充 PlatformUiKit 收口计划、共享决策记录与对应测试护栏
This commit is contained in:
2026-06-11 02:39:49 +08:00
parent ab5a0efe50
commit 84ded19f11
6 changed files with 116 additions and 64 deletions

View File

@@ -260,7 +260,50 @@ test('NPC 弹窗空态复用暗色平台空态', () => {
});
const recruitIntro = screen.getByText('同行名额已满,需要先让一人离队。');
const tradeDetailEmptyState = screen.getByText(
'请选择一件物品,右侧会显示数量、价格与详情。',
);
expect(recruitIntro.className).toContain('platform-status-message');
expect(recruitIntro.className).toContain('border-amber-300/15');
expect(tradeDetailEmptyState.className).toContain('platform-empty-state');
expect(tradeDetailEmptyState.className).toContain('border-dashed');
});
test('NPC 弹窗标准 dark footer CTA 复用 PlatformActionButton', async () => {
const user = userEvent.setup();
const { unmount } = render(
<NpcModals gameState={createEmptyGameState()} npcUi={createEmptyNpcUi()} />,
);
const cancelButtons = screen.getAllByRole('button', { name: '取消' });
const tradeConfirmButton = screen.getByRole('button', { name: '确认购买' });
const giftConfirmButton = screen.getByRole('button', { name: '确认赠礼' });
const recruitConfirmButton = screen.getByRole('button', { name: '确认招募' });
const footerButtons = [
cancelButtons[0],
tradeConfirmButton,
cancelButtons[1],
giftConfirmButton,
cancelButtons[2],
recruitConfirmButton,
].filter((button): button is HTMLElement => Boolean(button));
expect(footerButtons).toHaveLength(6);
footerButtons.forEach((button) => {
expect(button.className).toContain('platform-action-button--editor-dark');
expect(button.className).toContain('rounded-2xl');
});
unmount();
render(<NpcModals gameState={createGameState()} npcUi={createNpcUi()} />);
await user.click(screen.getByRole('button', { name: /月壳/ }));
const closeButton = screen.getByRole('button', { name: '关闭' });
expect(closeButton.className).toContain('platform-action-button--editor-dark');
expect(closeButton.className).toContain('rounded-2xl');
});