20260917165839
This commit is contained in:
1 parent
182ed86966
commit
38e1e66c3b
108 files changed
+2497
-1215
No files matched your search
@@ -46,26 +46,49 @@ describe('collectManagedI18nItems 受管键收集', () => {
|
||||
expect(items[1].defaultValue).toBe('姓名')
|
||||
})
|
||||
|
||||
it('收集界面配置分组标题的受管键', () => {
|
||||
it('收集界面配置分组标题的受管键:手填键优先,未填按 group.{模块}.{schema}.{编号} 派生', () => {
|
||||
const items = collectManagedI18nItems({
|
||||
module: demoModule(),
|
||||
fields: [],
|
||||
schemas: [
|
||||
{
|
||||
schemaVersion: 1,
|
||||
children: [
|
||||
{
|
||||
type: 'group',
|
||||
title: '基础信息',
|
||||
i18n: 'group.demo.basic',
|
||||
children: [],
|
||||
},
|
||||
],
|
||||
schemaType: 'view',
|
||||
schema: {
|
||||
schemaVersion: 1,
|
||||
children: [
|
||||
{
|
||||
type: 'group',
|
||||
id: 'group1',
|
||||
title: '基础信息',
|
||||
i18n: 'group.demo.basic',
|
||||
children: [],
|
||||
},
|
||||
{ type: 'group', id: 'group2', title: '费用信息', children: [] },
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
})
|
||||
expect(items.map((i) => i.key)).toContain('group.demo.basic')
|
||||
expect(items.find((i) => i.key === 'group.demo.basic').defaultValue).toBe('基础信息')
|
||||
// 未手填键的分组:按 schema 类型 + 分组编号派生,标题原文作为默认语言值
|
||||
const derived = items.find((i) => i.key === 'group.demo.view.group2')
|
||||
expect(derived.defaultValue).toBe('费用信息')
|
||||
expect(derived.id).toBe('group:group.demo.view.group2')
|
||||
})
|
||||
|
||||
it('分组缺失编号(老数据未归一化)时不派生病造键', () => {
|
||||
const items = collectManagedI18nItems({
|
||||
module: demoModule(),
|
||||
fields: [],
|
||||
schemas: [
|
||||
{
|
||||
schemaType: 'edit',
|
||||
schema: { schemaVersion: 1, children: [{ type: 'group', title: '基础信息' }] },
|
||||
},
|
||||
],
|
||||
})
|
||||
expect(items.filter((i) => i.key.startsWith('group.'))).toEqual([])
|
||||
})
|
||||
|
||||
it('模块编码为空时不产出受管键(新建未填编码)', () => {
|
||||
|
||||
Reference in new issue
Block a user