弹窗优化

This commit is contained in:
tianmo committed 2026-09-21 10:30:33 +08:00
1 parent be058c6c80
commit 650d9c0398
3 files changed
+40 -7

No files matched your search

@@ -0,0 +1,17 @@
'use strict';
const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');
const root = path.join(__dirname, '..');
const html = fs.readFileSync(path.join(root, 'progress.html'), 'utf8');
const windowSource = fs.readFileSync(path.join(root, 'js', 'progress-window.js'), 'utf8');
assert.match(windowSource, /minimizable: true/);
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\(\)/);
assert.equal((html.match(/requestStop\(\);/g) || []).length, 2);
assert.equal((html.match(/allowClose = true;[\s\S]{0,80}window\.close\(\)/g) || []).length, 2);
console.log('PASS: 系统关闭与停止按钮共用暂停确认流程');