等待后端更新接口
This commit is contained in:
@@ -11,6 +11,10 @@ function read(relativePath) {
|
||||
|
||||
test('家谱入口只接受本地家谱业务页作为返回目标', () => {
|
||||
assert.equal(GenealogyEntryPages.getTargetPage('?next=profile-feed.html'), 'profile-feed.html');
|
||||
assert.equal(
|
||||
GenealogyEntryPages.getTargetPage('?next=' + encodeURIComponent('profile-feed-detail.html?feedId=12#comments')),
|
||||
'profile-feed-detail.html?feedId=12#comments'
|
||||
);
|
||||
assert.equal(GenealogyEntryPages.getTargetPage('?next=https%3A%2F%2Fevil.example'), 'profile-family-home.html');
|
||||
});
|
||||
|
||||
@@ -39,6 +43,10 @@ test('家谱入口只使用 AppGenealogyVo 的真实字段并保持大整数 ID
|
||||
GenealogyEntryPages.buildEntryUrl('2062179707935264769', 'profile-feed.html'),
|
||||
'profile-feed.html?genealogyId=2062179707935264769'
|
||||
);
|
||||
assert.equal(
|
||||
GenealogyEntryPages.buildEntryUrl('2062179707935264769', 'profile-feed-detail.html?feedId=12&genealogyId=old#comments'),
|
||||
'profile-feed-detail.html?feedId=12&genealogyId=2062179707935264769#comments'
|
||||
);
|
||||
});
|
||||
|
||||
test('家谱创建只构造 AppGenealogyCreateBody 并省略空可选字段', () => {
|
||||
@@ -165,11 +173,30 @@ test('负数额度不向用户展示为可用数量', () => {
|
||||
|
||||
test('我的家谱页是可用的真实列表入口', () => {
|
||||
const source = read('profile-families.html');
|
||||
const script = read('public/js/genealogy-entry-pages.js');
|
||||
|
||||
assert.doesNotMatch(source, /data-feature-status="pending"/);
|
||||
assert.doesNotMatch(source, /pending-pages\.js/);
|
||||
assert.match(source, /data-genealogy-list="mine"/);
|
||||
assert.match(source, /data-genealogy-list="mine"[^>]*>[\s\S]*data-api-state="loading"/);
|
||||
assert.match(source, /genealogy-entry-pages\.js/);
|
||||
assert.match(script, /function setGenealogyListState\(container, type, message\)/);
|
||||
assert.match(script, /setGenealogyListState\(container, 'loading', '正在读取我的家谱…'\)/);
|
||||
assert.match(script, /setGenealogyListState\(container, 'empty', '当前账号还没有可进入的家谱'\)/);
|
||||
assert.match(script, /当前账号无权查看我的家谱。/);
|
||||
assert.match(script, /result = await api\.genealogiesMine\(\);/);
|
||||
assert.match(script, /result = await api\.genealogyQuota\(\);/);
|
||||
});
|
||||
|
||||
test('家谱排序在未声明 PC 读取和保存契约时保持明确不可操作状态', () => {
|
||||
const source = read('profile-families.html');
|
||||
const apiClient = read('utils/ApiClient.js');
|
||||
const verification = read('docs/验证20%记录.md');
|
||||
|
||||
assert.match(source, /class="module-card is-unavailable" aria-disabled="true">\s*<span class="icon">序<\/span>\s*<h3>家谱排序<\/h3>/);
|
||||
assert.match(source, /当前 PC 家谱契约未提供自定义排序的读取或保存接口/);
|
||||
assert.doesNotMatch(apiClient, /sortGenealogy|genealogySort/);
|
||||
assert.match(verification, /家谱邀请、家谱删除、家谱排序、分享奖励/);
|
||||
});
|
||||
|
||||
test('创建家谱页开放真实 PC 表单且不允许手填业务 ID', () => {
|
||||
@@ -178,8 +205,17 @@ test('创建家谱页开放真实 PC 表单且不允许手填业务 ID', () => {
|
||||
assert.doesNotMatch(source, /data-feature-status="pending"/);
|
||||
assert.doesNotMatch(source, /pending-pages\.js/);
|
||||
assert.match(source, /data-genealogy-create-page/);
|
||||
assert.match(source, /data-genealogy-create-quota/);
|
||||
assert.match(source, /data-genealogy-create-quota role="status" aria-live="polite"/);
|
||||
assert.match(source, /data-genealogy-create-status/);
|
||||
assert.match(source, /data-genealogy-create-form novalidate/);
|
||||
assert.match(source, /class="field-required"/);
|
||||
assert.match(source, /role="group" aria-labelledby="family-region-label" aria-describedby="family-create-status"/);
|
||||
assert.match(source, /<label for="familyProvinceCode">省/);
|
||||
assert.match(source, /<label for="familyCityCode">市/);
|
||||
assert.match(source, /<label for="familyDistrictCode">区县/);
|
||||
assert.match(source, /data-region-picker-status role="status" aria-live="polite"/);
|
||||
assert.match(source, /<div id="family-create-status" class="upload-status" data-genealogy-create-status role="status" aria-live="polite"/);
|
||||
assert.match(source, /<p id="familyCoverStatus" class="upload-status" role="status" aria-live="polite">/);
|
||||
assert.match(source, /name="coverOssId"\s+type="hidden"/);
|
||||
assert.match(source, /data-upload-target="#familyCoverOssId"/);
|
||||
assert.match(source, /public\/js\/region-pages\.js/);
|
||||
@@ -190,6 +226,50 @@ test('创建家谱页开放真实 PC 表单且不允许手填业务 ID', () => {
|
||||
assert.doesNotMatch(source, /name="coverOssId"[^>]*type="text"/);
|
||||
});
|
||||
|
||||
test('公共创建入口复用真实 PC 创建表单,不保留无效的静态提交', () => {
|
||||
const source = read('create-genealogy.html');
|
||||
|
||||
assert.match(source, /data-genealogy-create-page/);
|
||||
assert.match(source, /data-genealogy-create-form novalidate aria-describedby="public-create-status"/);
|
||||
assert.match(source, /data-genealogy-create-quota role="status" aria-live="polite"/);
|
||||
assert.match(source, /data-genealogy-create-status role="status" aria-live="polite"/);
|
||||
assert.match(source, /<label class="field" for="publicFamilyName">谱名/);
|
||||
assert.match(source, /<label class="field" for="publicFamilySurname">主要姓氏/);
|
||||
assert.match(source, /name="(?:ancestralHall|originPlace|addressDetail|intro|visibility|joinMode)"/);
|
||||
assert.match(source, /data-region-picker-status role="status" aria-live="polite"/);
|
||||
assert.match(source, /id="publicJoinMode"[^>]*aria-describedby="public-invite-mode-note"/);
|
||||
assert.match(source, /当前 PC 未提供邀请码生成、发送或管理接口/);
|
||||
assert.match(source, /data-genealogy-create-submit/);
|
||||
assert.match(source, /public\/js\/profile-common\.js/);
|
||||
assert.match(source, /public\/js\/region-pages\.js/);
|
||||
assert.match(source, /public\/js\/genealogy-entry-pages\.js/);
|
||||
assert.doesNotMatch(source, /data-genealogy-form="create"|data-success-url/);
|
||||
assert.doesNotMatch(source, /name="(?:genealogyId|ownerUserId|coverOssId)"/);
|
||||
});
|
||||
|
||||
test('创建页保留合法邀请模式,但不把缺失的邀请码管理伪装成已开放能力', () => {
|
||||
const profileCreate = read('profile-create-family.html');
|
||||
const publicCreate = read('create-genealogy.html');
|
||||
|
||||
[profileCreate, publicCreate].forEach((source) => {
|
||||
assert.match(source, /<option value="2">邀请码加入<\/option>/);
|
||||
assert.match(source, /当前 PC 未提供邀请码生成、发送或管理接口/);
|
||||
});
|
||||
assert.match(profileCreate, /id="joinMode"[^>]*aria-describedby="family-invite-mode-note"/);
|
||||
assert.match(publicCreate, /id="publicJoinMode"[^>]*aria-describedby="public-invite-mode-note"/);
|
||||
});
|
||||
|
||||
test('创建家谱把加载、额度不足、校验和请求失败写入统一状态容器', () => {
|
||||
const source = read('public/js/genealogy-entry-pages.js');
|
||||
|
||||
assert.match(source, /root\.ProfileUI && root\.ProfileUI\.setApiState/);
|
||||
assert.match(source, /正在读取创建额度…', 'loading'/);
|
||||
assert.match(source, /当前没有可用的家谱创建额度', 'empty'/);
|
||||
assert.match(source, /setCreateStatus\(validation, 'error'\)/);
|
||||
assert.match(source, /getApiStateType\(error\)/);
|
||||
assert.match(source, /正在创建…/);
|
||||
});
|
||||
|
||||
test('加入家谱页面不允许用户手工填写 genealogyId', () => {
|
||||
const source = read('join-genealogy.html');
|
||||
|
||||
@@ -244,7 +324,7 @@ test('当前家谱名称从真实家谱响应写入会话上下文,并在页
|
||||
assert.match(common, /href="profile-families\.html"/);
|
||||
assert.match(entry, /data-genealogy-name=/);
|
||||
assert.match(entry, /root\.ProfileUI\.setCurrentGenealogyContext\(verified\.genealogyId, verified\.genealogyName\)/);
|
||||
assert.match(familyHome, /root\.ProfileUI\.setCurrentGenealogyContext\(result\.overview\.genealogyId, result\.overview\.genealogyName\)/);
|
||||
assert.match(familyHome, /root\.ProfileUI\.setCurrentGenealogyContext\(result\.genealogyId, result\.genealogyName\)/);
|
||||
});
|
||||
|
||||
test('小屏导航提供统一入口,并且所有家谱内链接继续透传当前上下文', () => {
|
||||
|
||||
Reference in New Issue
Block a user