等待后端更新接口
This commit is contained in:
@@ -184,6 +184,9 @@ test('相册页面拆分列表、编辑和照片详情且不允许手填 OSS ID
|
||||
});
|
||||
assert.match(listPage, /data-album-list/);
|
||||
assert.match(editPage, /name="albumName"/);
|
||||
assert.match(editPage, /data-album-form[^>]+novalidate/);
|
||||
assert.match(editPage, /class="field-required"/);
|
||||
assert.match(editPage, /<div class="api-status" data-album-form-status/);
|
||||
assert.match(editPage, /name="coverOssId" type="hidden"/);
|
||||
assert.match(editPage, /name="status" type="hidden" value="0"/);
|
||||
assert.match(detailPage, /data-album-detail/);
|
||||
@@ -191,5 +194,42 @@ test('相册页面拆分列表、编辑和照片详情且不允许手填 OSS ID
|
||||
assert.match(detailPage, /name="ossId" type="hidden"/);
|
||||
assert.match(detailPage, /name="shootTime" type="datetime-local"/);
|
||||
assert.match(detailPage, /name="status" type="hidden" value="0"/);
|
||||
assert.match(detailPage, /data-album-photo-form novalidate/);
|
||||
assert.match(detailPage, /<div class="api-status" data-album-photo-status/);
|
||||
assert.doesNotMatch(editPage + detailPage, /type="text"[^>]+(?:coverOssId|ossId)|name="albumId"|name="photoId"/);
|
||||
});
|
||||
|
||||
test('相册列表、详情和表单将加载、空数据、403 与请求失败写入统一状态组件', () => {
|
||||
const projectRoot = path.join(__dirname, '..');
|
||||
const listPage = fs.readFileSync(path.join(projectRoot, 'profile-album.html'), 'utf8');
|
||||
const detailPage = fs.readFileSync(path.join(projectRoot, 'profile-album-detail.html'), 'utf8');
|
||||
const source = fs.readFileSync(modulePath, 'utf8');
|
||||
|
||||
assert.match(listPage, /data-album-list[^>]*>[\s\S]*data-api-state="loading"/);
|
||||
assert.match(detailPage, /data-album-detail[^>]*>[\s\S]*data-api-state="loading"/);
|
||||
assert.match(detailPage, /data-album-photo-list[^>]*>[\s\S]*data-api-state="loading"/);
|
||||
assert.match(source, /root\.ProfileUI && root\.ProfileUI\.setApiState/);
|
||||
assert.match(source, /setStatus\('\[data-album-list\]', '正在加载相册…', 'loading'\)/);
|
||||
assert.match(source, /setStatus\('\[data-album-list\]', '暂无相册', 'empty'\)/);
|
||||
assert.match(source, /setStatus\('\[data-album-photo-list\]', '正在加载照片…', 'loading'\)/);
|
||||
assert.match(source, /setStatus\('\[data-album-photo-list\]', '暂无照片', 'empty'\)/);
|
||||
assert.match(source, /当前账号无权查看该相册照片。/);
|
||||
assert.match(source, /正在读取家谱权限…', 'loading'/);
|
||||
assert.match(source, /setStatus\('\[data-album-form-status\]', validation, 'error'\)/);
|
||||
assert.match(source, /setStatus\('\[data-album-photo-status\]', validation, 'error'\)/);
|
||||
assert.match(source, /getApiStateType\(error\)/);
|
||||
});
|
||||
|
||||
test('相册与照片只接受后端布尔能力字段,并在所有写路径上门控', () => {
|
||||
const source = fs.readFileSync(modulePath, 'utf8');
|
||||
const canEditAlbums = requireFunction('canEditAlbums');
|
||||
|
||||
assert.equal(canEditAlbums({ canEditContent: true }), true);
|
||||
assert.equal(canEditAlbums({ canManage: true }), true);
|
||||
assert.equal(canEditAlbums({ canEditContent: 'true', canManage: false }), false);
|
||||
assert.match(source, /canEditContent = canEditAlbums\(detail\)/);
|
||||
assert.match(source, /if \(writePending \|\| !canEditContent \|\| !genealogyId \|\| redirectUnauthorized\(api\)\) return;/);
|
||||
assert.match(source, /if \(writePending \|\| !canEditContent \|\| !genealogyId \|\| !albumId \|\| redirectUnauthorized\(api\)\) return;/);
|
||||
assert.match(source, /if \(writePending \|\| !canEditContent \|\| !genealogyId \|\| !normalizeId\(albumId\) \|\| redirectUnauthorized\(api\)\) return;/);
|
||||
assert.match(source, /if \(writePending \|\| !canEditContent \|\| !genealogyId \|\| !albumId \|\| !normalizeId\(photoId\) \|\| redirectUnauthorized\(api\)\) return;/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user