فینورا پرو - سامانه جامع حسابداری و صدور فاکتور

test(a02): assert no global workbook and single-flight lifecycle

davoodmehraban89 committed Oct 31, 2026 at 00:43 UTC 748b2116ed7a4fc7c038d6a7cb02eb24e50b4831
1 file changed +13 -1
tests/ui-control-structure.test.mjs
+13 -1
@@ -195,7 +195,7 @@ test('A02: Excel imports reject destructive replacement before touching master d
195 assert.ok(importModeSelect, 'Excel import mode selector missing');
196 assert.doesNotMatch(importModeSelect,/<option value="replace"/,
197 'destructive Excel option must not be offered; the backup restore option is separate');
198 - assert.match(settings,/window\.__importKind !== kind/);
198 + assert.match(settings,/pending\?\.kind !== kind/);
199 assert.match(settings,/data-excel-import-submit/);
200 assert.doesNotMatch(settings,/_confirmImport\(\$\{JSON\.stringify\(kind\)/,
201 'untrusted filenames must never be embedded as executable inline HTML');
@@ -216,6 +216,18 @@ test('A03: company switch, posted journals and printable ledger encode untrusted
216 assert.ok(ledger.split('this._esc(Formatters.toPersianDigits(r.date').length>=3);
217 });
218
219 +test('A02: private Excel preview releases data on cancel and blocks concurrent import', () => {
220 + const settings=fs.readFileSync(path.join(root,'src','views','SettingsView.js'),'utf8');
221 + assert.ok(settings.includes('let pendingExcelImport = null'));
222 + assert.ok(settings.includes('let excelImportBusy = false'));
223 + assert.ok(settings.includes('if (excelImportBusy) return;'));
224 + assert.ok(settings.includes('if (pendingExcelImport === pending) pendingExcelImport = null;'));
225 + assert.ok(settings.includes('submitButton.disabled = true'));
226 + assert.ok(settings.includes('onClose: () =>'));
227 + assert.doesNotMatch(settings,/window\.__import(?:RawData|Kind)/,
228 + 'private workbook contents must never be exposed as global window properties');
229 +});
230 +
231 test('Q01: Escape is handled once for nested financial dialogs and shortcut target is topmost', () => {
232 const shortcuts = fs.readFileSync(path.join(root,'src','core','KeyboardShortcuts.js'),'utf8');
233 const modal = fs.readFileSync(path.join(root,'src','core','Modal.js'),'utf8');