Files
Agent-System-Frontend/test/settings-editor.test.tsx
T
weichen 6106db250c Complete project member duty and permission settings flows
Why: Raw identifiers and mixed settings scopes made project administration difficult and hid authorization boundaries.

Evidence: SELF receipts /tmp/project-settings-frontend-full-green-20261014-973d52c1.json and /tmp/project-settings-browser-fixture-final-20261014-973d52c1.json record 284 tests, typecheck, build and 15 real React browser fixture flows. Live composition and formal acceptance remain NOT_RUN.

Impact: Add searchable member and document selectors, role filters, versioned duty changes, removal impact review and shared permission details/matrix. Consume server capabilities and settings scopes, preserve personal preferences and default restoration, and discard late responses.

Refs: P3/P4/P5/P6/P7, docs/records/2026-10-14-rdm-settings-completion-contract.md
2026-10-14 02:29:06 +00:00

31 lines
1.6 KiB
TypeScript

import { describe, expect, it, vi } from 'vitest'
import { renderToStaticMarkup } from 'react-dom/server'
import { SettingInput } from '../src/components/SettingsModal'
import { BorrowPanels } from '../src/components/BorrowPanels'
import type { SettingDesc } from '../src/contracts'
vi.mock('../src/store', () => ({ useStore: (select: (state: unknown) => unknown) => select({ ui: {} }) }))
const field = (type: SettingDesc['type'], options?: string[]): SettingDesc => ({
key: 'deliverables.style', group: 'deliverables', label: '交付风格', type, options, effect: 'new-run',
})
describe('setting editors preserve types and readable values', () => {
it('uses a number input for numeric values rather than submitting arbitrary strings', () => {
expect(renderToStaticMarkup(<SettingInput desc={field('number')} value={12} onChange={() => {}} />)).toContain('type="number"')
})
it('shows readable enum names and a distinct inherited choice', () => {
const html = renderToStaticMarkup(<SettingInput desc={field('enum', ['modern', 'formal', 'minimal'])} value="" onChange={() => {}} />)
expect(html).toContain('沿用默认')
expect(html).toContain('>现代</option>')
expect(html).toContain('>正式</option>')
expect(html).toContain('>简洁</option>')
})
it('personal supplementary panels no longer offer system credentials', () => {
const html = renderToStaticMarkup(<BorrowPanels />)
expect(html).not.toContain('新增密钥')
expect(html).not.toContain('主模型')
expect(html).toContain('条件注入')
expect(html).toContain('用户命令')
})
})