等待后端更新接口

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
@@ -160,7 +160,7 @@ test('备忘录编辑器拒绝不可重读的停用记录', () => {
assert.equal(MemoPages.isEditableMemo(null), false);
});
test('备忘录列表和编辑页开放 PC CRUD 且不允许手填 OSS ID 或业务状态', () => {
test('备忘录列表和编辑页按家谱能力开放 PC CRUD且不允许手填 OSS ID 或业务状态', () => {
const root = path.join(__dirname, '..');
const listPage = fs.readFileSync(path.join(root, 'profile-memo.html'), 'utf8');
const editPage = fs.readFileSync(path.join(root, 'profile-memo-edit.html'), 'utf8');
@@ -168,17 +168,47 @@ test('备忘录列表和编辑页开放 PC CRUD 且不允许手填 OSS ID 或业
assert.match(listPage, /data-memo-list/);
assert.match(listPage, /data-memo-detail/);
assert.match(listPage, /data-memo-create-link hidden/);
assert.doesNotMatch(listPage, /原始 JSON|不开放编辑和删除/);
assert.match(editPage, /name="remindTime" type="datetime-local"/);
assert.match(editPage, /data-memo-form[^>]*novalidate/);
assert.match(editPage, /for="memoTitle">备忘标题<span class="field-required"/);
assert.match(editPage, /name="completed"/);
assert.match(editPage, /value="0"/);
assert.match(editPage, /value="1"/);
assert.match(editPage, /name="status" type="hidden" value="0"/);
assert.match(editPage, /name="mediaOssIds" type="hidden"/);
assert.match(editPage, /data-memo-clear-media/);
assert.match(editPage, /data-memo-form-status role="status" aria-live="polite"/);
assert.match(editPage, /data-memo-editor-placeholder>[\s\S]*api-state--loading" role="status" aria-live="polite" aria-busy="true"/);
assert.doesNotMatch(editPage, /name="(?:mediaOssIds|status)"[^>]*type="text"/);
assert.match(editPage, /public\/js\/md5\.js/);
assert.match(editPage, /public\/js\/upload-pages\.js/);
assert.match(editPage, /public\/js\/memo-pages\.js/);
assert.match(styles, /\[data-memo-editor\]\[hidden\][^{]*\{[^}]*display:\s*none\s*!important/s);
});
test('备忘录只向内容维护者或管理员开放写操作', () => {
const root = path.join(__dirname, '..');
const script = fs.readFileSync(path.join(root, 'public', 'js', 'memo-pages.js'), 'utf8');
assert.equal(MemoPages.canEditRecords({ canEditContent: true }), true);
assert.equal(MemoPages.canEditRecords({ canManage: true }), true);
assert.equal(MemoPages.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-memo-delete-id/);
});
test('备忘录使用统一的加载、空数据、失败和无权限状态,以及提交中的按钮反馈', () => {
const root = path.join(__dirname, '..');
const script = fs.readFileSync(path.join(root, 'public', 'js', 'memo-pages.js'), 'utf8');
assert.match(script, /function getApiStateType\(error\)[\s\S]*isForbidden\(error\) \? 'forbidden' : 'error'/);
assert.match(script, /setState\(query\('\[data-memo-list\]'\), 'loading', '正在加载备忘录…'\)/);
assert.match(script, /setState\(query\('\[data-memo-detail\]'\), 'loading', '正在加载备忘录详情…'\)/);
assert.match(script, /setFormStatus\('正在读取家谱权限…', 'loading'\)/);
assert.match(script, /setFormStatus\(validation, 'error'\)/);
assert.match(script, /setWritePending\(true, '正在保存…'\)/);
assert.match(script, /setFormStatus\('正在保存备忘录…', 'loading'\)/);
});