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(''); const sidepanelIndex = html.indexOf(''); assert.equal(matches.length, 1); assert.match(html, /id="btn-contribution-mode"[^>]*title="进入贡献模式并打开上传页"/); assert.match(html, />贡献\/使用<\/button>/); assert.match(html, /<\/header>\s*
{ const source = fs.readFileSync('sidepanel/sidepanel.js', 'utf8'); assert.doesNotMatch(source, /openContributionUploadPage/); assert.doesNotMatch(source, /await openContributionUploadPage\(\)/); });