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/, ); }); });