Files
Genarrative/apps/ai-game-creator-shell/tests/agentProcessStyles.test.ts
T
suzmii 2257a78d6b 收口思考等待反馈与紧凑过程样式及失败状态
思考展开时隐藏重复预览并使用灯泡图标,首个响应前显示临时思考提示。
统一分钟内小数和分钟以上整数秒,保持内外过程的紧凑间距与正文层级。
失败工具与分组显示错误色,非零退出码不再误判为成功。
补齐状态、格式、样式和交互回归,本批其余需求留待后续PR。
2026-09-18 15:46:30 +08:00

40 lines
1.5 KiB
TypeScript

import { readFileSync } from 'node:fs';
import { describe, expect, it } from 'vitest';
const styles = readFileSync(
new URL('../src/styles.css', import.meta.url),
'utf8',
);
describe('回合结束后的过程样式', () => {
it('折叠层不再用 grid gap 叠加内部条目的原有 margin', () => {
const body = styles.match(/\.message-turn-process-body\s*\{([^}]+)\}/)?.[1];
expect(body).toBeDefined();
expect(body).toMatch(/display:\s*block/);
expect(body).not.toMatch(/(?:^|[;\s])gap\s*:/);
expect(styles).toMatch(
/\.message-turn-process-body\s*>\s*:is\(\.design-agent-reasoning,\s*\.agent-tool-call-group\)\s*\{[^}]*margin:\s*4px 0 0/,
);
expect(styles).toMatch(
/\.project-supervisor-message-list\s*>\s*:is\(\.design-agent-reasoning,\s*\.agent-tool-call-group\),/,
);
});
it('仅最外层摘要使用正文色,不覆盖内部过程色', () => {
expect(styles).toMatch(
/\.message-turn-process\s*>\s*summary\s*>\s*\.agent-process-summary\s*\{[^}]*color:\s*var\(--platform-text-strong/,
);
expect(styles).not.toMatch(
/\.message-turn-process-body\s*\{[^}]*color:\s*var\(--platform-text-strong/,
);
});
it('失败工具行与失败组摘要使用错误色', () => {
expect(styles).toContain(".agent-tool-call-group[data-has-failure='true']");
expect(styles).toMatch(
/\.agent-tool-call-group-row\[data-status='failed'\]\s*:is\([^}]+\)\s*\{\s*color:\s*var\(--platform-button-danger-text/,
);
});
});