6bb183902d
- 合并 dev 最新主线改动:同步当前认证页恢复、来源配置和侧栏能力的现有基线 - 本地补充修复:补齐 HeroSMS 手机验证与 sidepanel 初始化冲突,修正 Step 9 等待逻辑里的未声明变量,并同步结构/链路文档与回归测试 - 影响范围:OAuth 步骤 8/9、HeroSMS 配置、认证页内容脚本、侧栏初始化、项目文档与测试
30 lines
1.4 KiB
JavaScript
30 lines
1.4 KiB
JavaScript
const test = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('node:fs');
|
|
|
|
test('sidepanel html keeps a single contribution mode button in header', () => {
|
|
const html = fs.readFileSync('sidepanel/sidepanel.html', 'utf8');
|
|
const matches = html.match(/id="btn-contribution-mode"/g) || [];
|
|
const serviceIndex = html.indexOf('<script src="contribution-content-update-service.js"></script>');
|
|
const sidepanelIndex = html.indexOf('<script src="sidepanel.js"></script>');
|
|
|
|
assert.equal(matches.length, 1);
|
|
assert.match(html, /id="btn-contribution-mode"[^>]*title="进入贡献模式并打开官网页"/);
|
|
assert.match(html, />贡献\/使用教程<\/button>/);
|
|
assert.match(html, /<\/header>\s*<div id="contribution-update-layer"/);
|
|
assert.match(html, /id="contribution-update-layer"/);
|
|
assert.match(html, /id="contribution-update-hint"/);
|
|
assert.match(html, /id="contribution-update-hint-text"/);
|
|
assert.match(html, /id="btn-dismiss-contribution-update-hint"/);
|
|
assert.notEqual(serviceIndex, -1);
|
|
assert.notEqual(sidepanelIndex, -1);
|
|
assert.ok(serviceIndex < sidepanelIndex);
|
|
});
|
|
|
|
test('sidepanel source no longer keeps the legacy upload-page handler on the header contribution button', () => {
|
|
const source = fs.readFileSync('sidepanel/sidepanel.js', 'utf8');
|
|
|
|
assert.doesNotMatch(source, /openContributionUploadPage/);
|
|
assert.doesNotMatch(source, /await openContributionUploadPage\(\)/);
|
|
});
|