等待后端更新接口
This commit is contained in:
@@ -180,7 +180,7 @@ test('亲友记录编辑器拒绝不可重读的停用记录', () => {
|
||||
assert.equal(RelativePages.isEditableRecord(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-relative.html'), 'utf8');
|
||||
const editPage = fs.readFileSync(path.join(root, 'profile-relative-edit.html'), 'utf8');
|
||||
@@ -188,10 +188,15 @@ test('亲友记录列表和编辑页开放 PC CRUD 且不允许手填 OSS ID 或
|
||||
|
||||
assert.match(listPage, /data-relative-list/);
|
||||
assert.match(listPage, /data-relative-detail/);
|
||||
assert.match(listPage, /data-relative-create-link hidden/);
|
||||
assert.doesNotMatch(listPage, /原始 JSON|不开放编辑和删除/);
|
||||
assert.match(editPage, /name="eventTime" type="datetime-local"/);
|
||||
assert.match(editPage, /data-relative-form[^>]*novalidate/);
|
||||
assert.match(editPage, /for="relativeName">亲友姓名<span class="field-required"/);
|
||||
assert.match(editPage, /name="status" type="hidden" value="0"/);
|
||||
assert.match(editPage, /name="mediaOssIds" type="hidden"/);
|
||||
assert.match(editPage, /data-relative-form-status role="status" aria-live="polite"/);
|
||||
assert.match(editPage, /data-relative-editor-placeholder>[\s\S]*api-state--loading" role="status" aria-live="polite" aria-busy="true"/);
|
||||
assert.match(editPage, /data-relative-clear-media/);
|
||||
assert.doesNotMatch(editPage, /name="(?:mediaOssIds|status)"[^>]*type="text"/);
|
||||
assert.match(editPage, /public\/js\/md5\.js/);
|
||||
@@ -199,3 +204,28 @@ test('亲友记录列表和编辑页开放 PC CRUD 且不允许手填 OSS ID 或
|
||||
assert.match(editPage, /public\/js\/relative-pages\.js/);
|
||||
assert.match(styles, /\[data-relative-editor\]\[hidden\][^{]*\{[^}]*display:\s*none\s*!important/s);
|
||||
});
|
||||
|
||||
test('亲友记录只向内容维护者或管理员开放写操作', () => {
|
||||
const root = path.join(__dirname, '..');
|
||||
const script = fs.readFileSync(path.join(root, 'public', 'js', 'relative-pages.js'), 'utf8');
|
||||
|
||||
assert.equal(RelativePages.canEditRecords({ canEditContent: true }), true);
|
||||
assert.equal(RelativePages.canEditRecords({ canManage: true }), true);
|
||||
assert.equal(RelativePages.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-relative-delete-id/);
|
||||
});
|
||||
|
||||
test('亲友记录使用统一的加载、空数据、失败和无权限状态,以及提交中的按钮反馈', () => {
|
||||
const root = path.join(__dirname, '..');
|
||||
const script = fs.readFileSync(path.join(root, 'public', 'js', 'relative-pages.js'), 'utf8');
|
||||
|
||||
assert.match(script, /function getApiStateType\(error\)[\s\S]*isForbidden\(error\) \? 'forbidden' : 'error'/);
|
||||
assert.match(script, /setState\(query\('\[data-relative-list\]'\), 'loading', '正在加载亲友记录…'\)/);
|
||||
assert.match(script, /setState\(query\('\[data-relative-detail\]'\), 'loading', '正在加载亲友记录详情…'\)/);
|
||||
assert.match(script, /setFormStatus\('正在读取家谱权限…', 'loading'\)/);
|
||||
assert.match(script, /setFormStatus\(validation, 'error'\)/);
|
||||
assert.match(script, /setWritePending\(true, '正在保存…'\)/);
|
||||
assert.match(script, /setFormStatus\('正在保存亲友记录…', 'loading'\)/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user