等待后端更新接口
This commit is contained in:
@@ -129,6 +129,15 @@ test('视频文件元数据时长按秒取整且拒绝无效值', () => {
|
||||
assert.equal(VideoPages.normalizeDurationSeconds(Infinity), undefined);
|
||||
});
|
||||
|
||||
test('视频维护资格只接受服务端返回的内容或管理布尔能力', () => {
|
||||
const script = fs.readFileSync(path.join(__dirname, '..', 'public', 'js', 'video-pages.js'), 'utf8');
|
||||
|
||||
assert.equal(VideoPages.canEditVideos({ canEditContent: true }), true);
|
||||
assert.equal(VideoPages.canEditVideos({ canManage: true }), true);
|
||||
assert.equal(VideoPages.canEditVideos({ canEditContent: 'true', canManage: false }), false);
|
||||
assert.match(script, /setManagementAccess\(canEditVideos\(result\[0\]\)\)/);
|
||||
});
|
||||
|
||||
test('视频列表和编辑页开放真实 PC 功能且不允许手填 OSS ID', () => {
|
||||
const root = path.join(__dirname, '..');
|
||||
const listPage = fs.readFileSync(path.join(root, 'profile-video.html'), 'utf8');
|
||||
@@ -141,6 +150,9 @@ test('视频列表和编辑页开放真实 PC 功能且不允许手填 OSS ID',
|
||||
assert.match(listPage, /data-video-management hidden/);
|
||||
assert.match(listPage, /src="public\/js\/video-pages\.js"/);
|
||||
assert.match(editPage, /data-video-form data-video-management hidden/);
|
||||
assert.match(editPage, /data-video-form data-video-management hidden novalidate/);
|
||||
assert.match(editPage, /class="field-required"/);
|
||||
assert.match(editPage, /<div class="form-status" data-video-form-status/);
|
||||
assert.match(editPage, /name="videoTitle"/);
|
||||
assert.match(editPage, /name="videoDesc"/);
|
||||
assert.match(editPage, /name="coverOssId" type="hidden"/);
|
||||
@@ -152,3 +164,26 @@ test('视频列表和编辑页开放真实 PC 功能且不允许手填 OSS ID',
|
||||
assert.match(editPage, /public\/js\/video-pages\.js/);
|
||||
assert.match(styles, /\[data-video-management\]\[hidden\]\s*\{[^}]*display:\s*none\s*!important/s);
|
||||
});
|
||||
|
||||
test('视频编辑将权限读取、校验、保存中和失败状态接入公共状态组件', () => {
|
||||
const root = path.join(__dirname, '..');
|
||||
const listPage = fs.readFileSync(path.join(root, 'profile-video.html'), 'utf8');
|
||||
const editPage = fs.readFileSync(path.join(root, 'profile-video-edit.html'), 'utf8');
|
||||
const script = fs.readFileSync(path.join(root, 'public', 'js', 'video-pages.js'), 'utf8');
|
||||
|
||||
assert.match(listPage, /data-video-list[^>]*>[\s\S]*data-api-state="loading"/);
|
||||
assert.match(listPage, /data-video-detail[^>]*>[\s\S]*data-api-state="empty"/);
|
||||
assert.match(editPage, /data-api-state="loading"[^>]*data-video-permission-placeholder/);
|
||||
assert.match(script, /root\.ProfileUI && root\.ProfileUI\.setApiState/);
|
||||
assert.match(script, /function setPermissionPlaceholder\(type, message\)/);
|
||||
assert.match(script, /setVideoListState\('loading', '正在加载视频…'\)/);
|
||||
assert.match(script, /setVideoDetailState\('loading', '正在加载视频详情…'\)/);
|
||||
assert.match(script, /setVideoListState\('empty', '暂无家族视频'\)/);
|
||||
assert.match(script, /setVideoListState\('forbidden', '当前账号无权查看该家谱视频。'\)/);
|
||||
assert.match(script, /setVideoDetailState\(\n\s*getApiStateType\(error\)/);
|
||||
assert.match(script, /正在读取家谱权限…', 'loading'/);
|
||||
assert.match(script, /setPermissionPlaceholder\('forbidden', '当前账号没有视频维护权限。'\)/);
|
||||
assert.match(script, /setFormStatus\(validation, 'error'\)/);
|
||||
assert.match(script, /setWritePending\(true, '正在保存…'\)/);
|
||||
assert.match(script, /getApiStateType\(error\)/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user