等待后端更新接口

This commit is contained in:
2026-08-03 16:49:26 +08:00
parent ac5823547a
commit 5b79893650
131 changed files with 5324 additions and 1392 deletions
+31 -1
View File
@@ -180,7 +180,7 @@ test('世系人物选择器只使用稳定人物编号和名称', () => {
);
});
test('成长记录列表和编辑页开放 PC CRUD 且不允许手填人物或 OSS ID', () => {
test('成长记录列表和编辑页按家谱能力开放 PC CRUD且不允许手填人物或 OSS ID', () => {
const root = path.join(__dirname, '..');
const listPage = fs.readFileSync(path.join(root, 'profile-growth.html'), 'utf8');
const editPage = fs.readFileSync(path.join(root, 'profile-growth-edit.html'), 'utf8');
@@ -188,13 +188,43 @@ test('成长记录列表和编辑页开放 PC CRUD 且不允许手填人物或 O
assert.match(listPage, /data-growth-list/);
assert.match(listPage, /data-growth-detail/);
assert.match(listPage, /data-growth-create-link hidden/);
assert.doesNotMatch(listPage, /原始 JSON|不开放编辑和删除/);
assert.match(editPage, /name="lineagePersonId"[^>]*data-growth-lineage-person/);
assert.match(editPage, /data-growth-form[^>]*novalidate/);
assert.match(editPage, /for="growthTitle">标题<span class="field-required"/);
assert.match(editPage, /name="status" type="hidden" value="0"/);
assert.match(editPage, /name="mediaOssIds" type="hidden"/);
assert.match(editPage, /data-growth-form-status role="status" aria-live="polite"/);
assert.match(editPage, /data-growth-editor-placeholder>[\s\S]*api-state--loading" role="status" aria-live="polite" aria-busy="true"/);
assert.doesNotMatch(editPage, /name="(?:lineagePersonId|mediaOssIds)"[^>]*type="text"/);
assert.match(editPage, /public\/js\/md5\.js/);
assert.match(editPage, /public\/js\/upload-pages\.js/);
assert.match(editPage, /public\/js\/growth-pages\.js/);
assert.match(styles, /\[data-growth-editor\]\[hidden\][^{]*\{[^}]*display:\s*none\s*!important/s);
});
test('成长记录只向内容维护者或管理员开放写操作', () => {
const root = path.join(__dirname, '..');
const script = fs.readFileSync(path.join(root, 'public', 'js', 'growth-pages.js'), 'utf8');
assert.equal(GrowthPages.canEditRecords({ canEditContent: true }), true);
assert.equal(GrowthPages.canEditRecords({ canManage: true }), true);
assert.equal(GrowthPages.canEditRecords({ canEditContent: false, canManage: false }), false);
assert.match(script, /await loadCapability\(api, genealogyId\);/);
assert.match(script, /if \(writePending \|\| !canEditContent \|\| !genealogyId/);
assert.match(script, /if \(canEditContent\) \{[\s\S]*data-growth-delete-id/);
});
test('成长记录使用统一的加载、空数据、失败和无权限状态,以及提交中的按钮反馈', () => {
const root = path.join(__dirname, '..');
const script = fs.readFileSync(path.join(root, 'public', 'js', 'growth-pages.js'), 'utf8');
assert.match(script, /function getApiStateType\(error\)[\s\S]*isForbidden\(error\) \? 'forbidden' : 'error'/);
assert.match(script, /setState\(query\('\[data-growth-list\]'\), 'loading', '正在加载成长记录…'\)/);
assert.match(script, /setState\(query\('\[data-growth-detail\]'\), 'loading', '正在加载成长记录详情…'\)/);
assert.match(script, /setFormStatus\('正在读取家谱权限…', 'loading'\)/);
assert.match(script, /setFormStatus\(validation, 'error'\)/);
assert.match(script, /setWritePending\(true, '正在保存…'\)/);
assert.match(script, /setFormStatus\('正在保存成长记录…', 'loading'\)/);
});