进度修复

This commit is contained in:
tianmo committed 2026-10-30 16:31:27 +08:00
1 parent 63663f3bb7
commit 55dc52be37
7 files changed
+13 -6

No files matched your search

@@ -6,13 +6,20 @@ const path = require('node:path');
const root = path.join(__dirname, '..');
const html = fs.readFileSync(path.join(root, 'progress.html'), 'utf8');
const indexHtml = fs.readFileSync(path.join(root, 'index.html'), 'utf8');
const windowSource = fs.readFileSync(path.join(root, 'js', 'progress-window.js'), 'utf8');
const i18nSource = fs.readFileSync(path.join(root, 'js', 'i18n.js'), 'utf8');
const normalizePluginRoot = (pathname) => pathname.replace(/^\/+([A-Za-z]:)/, '$1');
assert.match(windowSource, /minimizable: true/);
assert.match(windowSource, /url: 'progress\.html',/);
assert.doesNotMatch(windowSource, /url: 'progress\.html\?/);
assert.match(i18nSource, /params\.get\('lang'\) \|\| params\.get\('locale'\)/);
for (const source of [html, indexHtml]) {
assert.match(source, /pathname\.replace\(\/\^\\\/\+\(\[A-Za-z\]:\)\/, '\$1'\)/);
}
assert.equal(normalizePluginRoot('//C:/Users/demo/plugin/'), 'C:/Users/demo/plugin/');
assert.equal(normalizePluginRoot('/Users/demo/plugin/'), '/Users/demo/plugin/');
assert.match(html, /addEventListener\('beforeunload'/);
assert.match(html, /function requestStop\(\)[\s\S]*writeControl\('pause'\)[\s\S]*resumeEl\.focus\(\)/);
assert.match(html, /if \(allowClose \|\| finished\) return;[\s\S]*event\.returnValue = false;[\s\S]*requestStop\(\)/);