验证20%
This commit is contained in:
@@ -213,19 +213,48 @@ test('家谱业务模块运行时统一委托 ProfileUI 读取和传播上下文
|
||||
});
|
||||
});
|
||||
|
||||
test('个人中心和内容发布在缺少家谱上下文时统一进入家谱入口', () => {
|
||||
test('个人中心只保留真实家谱入口,内容发布仍会透传家谱上下文', () => {
|
||||
const profile = read('profile.html');
|
||||
const content = read('profile-content.html');
|
||||
const familyHome = read('profile-family-home.html');
|
||||
const familyEntry = read('profile-families.html');
|
||||
const profileCommon = read('public/js/profile-common.js');
|
||||
const profileMain = profile.slice(0, profile.indexOf('</main>'));
|
||||
|
||||
assert.match(profile, /进入我的家谱/);
|
||||
assert.doesNotMatch(profile, /四川武胜汤氏族|四川达州刘氏族/);
|
||||
assert.match(profile, /href="profile-family-admin\.html" data-genealogy-context-link/);
|
||||
assert.match(profileMain, /进入我的家谱/);
|
||||
assert.match(profileMain, /href="profile-families\.html"/);
|
||||
assert.doesNotMatch(profileMain, /鹿野 Loyel|待处理|已发布内容|资料完善度/);
|
||||
assert.doesNotMatch(profileMain, /href="profile-(?:article|album|video|merit|gift|join-review)\.html"/);
|
||||
assert.match(content, /href="profile-feed\.html" data-feature-link="available" data-genealogy-context-link/);
|
||||
assert.match(familyHome, /href="profile-family-admin\.html" data-genealogy-context-link/);
|
||||
assert.match(familyEntry, /href="profile-family-admin\.html" data-genealogy-context-link/);
|
||||
assert.match(profileCommon, /function getGenealogyEntryUrl\(href\)/);
|
||||
assert.match(profileCommon, /genealogyId \? withGenealogyId\([^\n]+\) : getGenealogyEntryUrl\(/);
|
||||
assert.match(read('public/js/genealogy-entry-pages.js'), /if \(shouldRedirectToLogin\(api\)\) \{\s+redirectToLogin\(api\);/);
|
||||
});
|
||||
|
||||
test('当前家谱名称从真实家谱响应写入会话上下文,并在页头提供切换入口', () => {
|
||||
const common = read('public/js/profile-common.js');
|
||||
const entry = read('public/js/genealogy-entry-pages.js');
|
||||
const familyHome = read('public/js/family-home-pages.js');
|
||||
|
||||
assert.match(common, /genealogyContextStorageKey/);
|
||||
assert.match(common, /function setCurrentGenealogyContext\(genealogyId, genealogyName\)/);
|
||||
assert.match(common, /class="profile-current-genealogy"/);
|
||||
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\)/);
|
||||
});
|
||||
|
||||
test('小屏导航提供统一入口,并且所有家谱内链接继续透传当前上下文', () => {
|
||||
const common = read('public/js/profile-common.js');
|
||||
const css = read('public/css/public.css');
|
||||
|
||||
assert.match(common, /data-profile-mobile-menu-toggle/);
|
||||
assert.match(common, /data-profile-mobile-menu/);
|
||||
assert.match(common, /profile-family-home\.html" data-genealogy-context-link/);
|
||||
assert.match(common, /profile-family-admin\.html" data-genealogy-context-link/);
|
||||
assert.match(css, /\.profile-mobile-menu\.is-open/);
|
||||
assert.match(css, /\.profile-current-genealogy/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user