feat(aihr): harden M0-M2 mobile training flows

This commit is contained in:
2026-07-23 21:18:13 +08:00
parent 06322c994b
commit 927458b9e0
44 changed files with 1674 additions and 119 deletions
+26
View File
@@ -4,6 +4,17 @@ import test from 'node:test';
const read = (path) => readFile(new URL(path, import.meta.url), 'utf8');
const centeredButtonRule = (source, selector) => {
const rule = source.match(new RegExp(`\\.${selector}\\s*\\{([^}]*)\\}`))?.[1] || '';
assert.ok(rule, `missing .${selector} style rule`);
assert.match(rule, /display:\s*flex/);
assert.match(rule, /align-items:\s*center/);
assert.match(rule, /justify-content:\s*center/);
assert.match(rule, /padding:\s*0(?:;|\s)/);
assert.match(rule, /line-height:\s*1(?:;|\s)/);
};
test('银城大喇叭仅使用认证后的真实广播接口', async () => {
const service = await read('../src/services/broadcast.ts');
@@ -74,3 +85,18 @@ test('消息详情只交接短期且账号绑定的消息 ID,再进入问模
assert.match(service, /context\.accountKey !== accountKey \|\| context\.expiresAt <= now/);
assert.match(service, /clearBroadcastQuestionContext\(\)/);
});
test('M0/M1 的短文本操作控件始终在可点击区域内居中', async () => {
const [base, list, detail, ask] = await Promise.all([
read('../src/styles/base.css'),
read('../src/pages/user/broadcast/index.vue'),
read('../src/pages/user/broadcast/detail.vue'),
read('../src/pages/user/sop/index.vue')
]);
assert.match(base, /\.primary-button,\s*\.secondary-button,\s*\.ghost-button\s*\{[^}]*display:\s*flex[^}]*align-items:\s*center[^}]*justify-content:\s*center/);
centeredButtonRule(list, 'scope-tab');
centeredButtonRule(list, 'load-more');
centeredButtonRule(detail, 'ask-message-button');
centeredButtonRule(ask, 'broadcast-context-action');
});