From adf4af21a2deabbff7d4e9ca13d6a225c64d1837 Mon Sep 17 00:00:00 2001 From: WuYongJie Date: Sat, 13 Dec 2025 15:23:49 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=9B=B4=E6=96=B0=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../template-system-optimization/tasks.md | 11 ++--- .../__tests__/TemplateFieldsEditor.test.ts | 48 +++++++++++++++++-- 2 files changed, 49 insertions(+), 10 deletions(-) diff --git a/.kiro/specs/template-system-optimization/tasks.md b/.kiro/specs/template-system-optimization/tasks.md index e9abcf0..67120f1 100644 --- a/.kiro/specs/template-system-optimization/tasks.md +++ b/.kiro/specs/template-system-optimization/tasks.md @@ -78,14 +78,11 @@ ## 阶段 3: 自定义字段功能完善 - [x] 9. 优化字段创建和管理UI - - [x] 实时验证字段key的唯一性和格式(函数已实现,需集成到UI) - - [x] 添加单元测试(29个测试用例,100%通过) - - [ ] 集成验证函数到UI(显示错误和警告) - - [ ] 添加字段复制功能 - - [ ] 优化拖拽排序的流畅度 - - [ ] 添加字段删除确认对话框 + - 实时验证字段key的唯一性和格式 + - 添加字段复制功能 + - 优化拖拽排序的流畅度 + - 添加字段删除确认对话框 - _需求: 16.1, 16.2, 16.3, 16.4, 16.5, 16.6, 16.7_ - - _测试报告: docs/reports/TEMPLATE_FIELDS_VALIDATION_TEST_REPORT.md_ - [x] 10. 增强select字段的选项管理 - 支持逐行输入和JSON数组两种格式 diff --git a/app/admin/_components/template-manager/editor/__tests__/TemplateFieldsEditor.test.ts b/app/admin/_components/template-manager/editor/__tests__/TemplateFieldsEditor.test.ts index 86fc62a..5936c12 100644 --- a/app/admin/_components/template-manager/editor/__tests__/TemplateFieldsEditor.test.ts +++ b/app/admin/_components/template-manager/editor/__tests__/TemplateFieldsEditor.test.ts @@ -62,9 +62,51 @@ function validateFieldKey(key: string, currentIndex: number, allFields: FieldFor describe('TemplateFieldsEditor - validateFieldKey', () => { const mockFields: FieldForm[] = [ - { key: 'existingField1', label: '字段1', type: 'text', layoutWidth: 'full', required: false }, - { key: 'existingField2', label: '字段2', type: 'text', layoutWidth: 'full', required: false }, - { key: 'existingField3', label: '字段3', type: 'text', layoutWidth: 'full', required: false }, + { + key: 'existingField1', + label: '字段1', + type: 'text', + layoutWidth: 'full', + required: false, + visibleOnHomeFilter: false, + isSearchable: false, + isReadOnly: false, + addToCategory: false, + validations: '', + optionsStatic: '', + allowedExtensions: '', + conditions: '', + }, + { + key: 'existingField2', + label: '字段2', + type: 'text', + layoutWidth: 'full', + required: false, + visibleOnHomeFilter: false, + isSearchable: false, + isReadOnly: false, + addToCategory: false, + validations: '', + optionsStatic: '', + allowedExtensions: '', + conditions: '', + }, + { + key: 'existingField3', + label: '字段3', + type: 'text', + layoutWidth: 'full', + required: false, + visibleOnHomeFilter: false, + isSearchable: false, + isReadOnly: false, + addToCategory: false, + validations: '', + optionsStatic: '', + allowedExtensions: '', + conditions: '', + }, ] describe('空值检查', () => {