Refine sidepanel plus payment visibility
This commit is contained in:
@@ -5,13 +5,20 @@ 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 headerEndIndex = html.indexOf('</header>');
|
||||
const adBarIndex = html.indexOf('id="auto-run-ad-bar"');
|
||||
const contributionLayerIndex = html.indexOf('id="contribution-update-layer"');
|
||||
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.notEqual(headerEndIndex, -1);
|
||||
assert.notEqual(adBarIndex, -1);
|
||||
assert.notEqual(contributionLayerIndex, -1);
|
||||
assert.ok(headerEndIndex < adBarIndex);
|
||||
assert.ok(adBarIndex < contributionLayerIndex);
|
||||
assert.match(html, /id="contribution-update-layer"/);
|
||||
assert.match(html, /id="contribution-update-hint"/);
|
||||
assert.match(html, /id="contribution-update-hint-text"/);
|
||||
|
||||
Reference in New Issue
Block a user