等待后端更新接口
This commit is contained in:
@@ -166,7 +166,7 @@ test('谱文写后重读必须返回同一条稳定记录', () => {
|
||||
assert.equal(matchesSavedArticle({}, '2060000000000000001'), false);
|
||||
});
|
||||
|
||||
test('谱文页面开放 PC CRUD 且不提供手填分类、业务 ID 或停用状态', () => {
|
||||
test('谱文页面按家谱能力开放 PC CRUD,且不提供手填分类、业务 ID 或停用状态', () => {
|
||||
const projectRoot = path.join(__dirname, '..');
|
||||
const listPage = fs.readFileSync(path.join(projectRoot, 'profile-article.html'), 'utf8');
|
||||
const editPage = fs.readFileSync(path.join(projectRoot, 'profile-article-edit.html'), 'utf8');
|
||||
@@ -178,11 +178,34 @@ test('谱文页面开放 PC CRUD 且不提供手填分类、业务 ID 或停用
|
||||
assert.match(listPage, /public\/js\/article-pages\.js/);
|
||||
assert.doesNotMatch(editPage, /data-feature-status="pending"|pending-pages\.js/);
|
||||
assert.match(editPage, /name="articleTitle"/);
|
||||
assert.match(editPage, /data-article-form[^>]*novalidate/);
|
||||
assert.match(editPage, /for="articleTitle">谱文标题<span class="field-required"/);
|
||||
assert.match(editPage, /name="articleSummary"/);
|
||||
assert.match(editPage, /name="articleContent"/);
|
||||
assert.match(editPage, /for="articleContent">正文<span class="field-required"/);
|
||||
assert.match(editPage, /name="authorName"/);
|
||||
assert.match(editPage, /name="coverOssId" type="hidden"/);
|
||||
assert.match(editPage, /name="status" type="hidden" value="0"/);
|
||||
assert.match(editPage, /data-article-form-status role="status" aria-live="polite"/);
|
||||
assert.match(editPage, /public\/js\/article-pages\.js/);
|
||||
assert.doesNotMatch(editPage, /name="articleId"|name="categoryId"|type="text"[^>]+coverOssId/);
|
||||
});
|
||||
|
||||
test('谱文只接受后端布尔能力字段,并在提交层保持写权限门控', () => {
|
||||
const script = fs.readFileSync(modulePath, 'utf8');
|
||||
|
||||
assert.equal(requireFunction('canEditArticles')({ canEditContent: true }), true);
|
||||
assert.equal(requireFunction('canEditArticles')({ canManage: true }), true);
|
||||
assert.equal(requireFunction('canEditArticles')({ canEditContent: 'true', canManage: false }), false);
|
||||
assert.match(script, /if \(writePending \|\| !canEditContent \|\| !genealogyId/);
|
||||
assert.match(script, /canEditContent = canEditArticles\(detail\)/);
|
||||
});
|
||||
|
||||
test('谱文编辑表单使用统一状态与提交中反馈', () => {
|
||||
const script = fs.readFileSync(modulePath, 'utf8');
|
||||
|
||||
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