feat(ui): 优化顶部安全距离,实现微信小程序与H5端无缝兼容及胶囊避让

这个提交包含在:
wikiboss
2026-09-16 20:53:02 +08:00
父节点 6f6e6229ec
当前提交 6d3076cdb8
共有 6 个文件被更改,包括 56 次插入 和 4 次删除

查看文件

@@ -358,8 +358,44 @@ describe('ThemeManager (TDD 测试套件: 暖色系与双主题设计系统)', (
}
});
});
describe('10. 顶部安全距离小程序与 H5 多端兼容门禁校验', () => {
const rootDir = path.resolve(__dirname, '../../');
const appVuePath = path.join(rootDir, 'pwuniapp', 'App.vue');
const indexVuePath = path.join(rootDir, 'pwuniapp', 'pages', 'index', 'index.vue');
const activityVuePath = path.join(rootDir, 'pwuniapp', 'pages', 'activity', 'list.vue');
const orderVuePath = path.join(rootDir, 'pwuniapp', 'pages', 'order', 'list.vue');
const userVuePath = path.join(rootDir, 'pwuniapp', 'pages', 'user', 'index.vue');
it('App.vue 必须在全局定义顶部安全间距变量与小程序/H5适配规则', () => {
const content = fs.readFileSync(appVuePath, 'utf-8');
expect(content).toContain('--safe-header-gap');
expect(content).toContain('--status-bar-height');
});
it('四大 TabBar 页面顶部必须全部采用 --safe-header-gap 规范化安全留白', () => {
const files = [indexVuePath, activityVuePath, orderVuePath, userVuePath];
for (const file of files) {
const content = fs.readFileSync(file, 'utf-8');
const relativeName = path.relative(rootDir, file);
expect({
file: relativeName,
hasSafeHeaderGap: content.includes('--safe-header-gap')
}).toEqual({
file: relativeName,
hasSafeHeaderGap: true
});
}
});
it('首页必须针对小程序端具备胶囊按钮避让属性', () => {
const content = fs.readFileSync(indexVuePath, 'utf-8');
expect(content.includes('capsule-space') || content.includes('MP-WEIXIN')).toBe(true);
});
});
});