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

test(q01): gate desktop toggle focus and text-only financial confirmation contracts

davoodmehraban89 committed Oct 30, 2026 at 23:57 UTC 51f0f60992da3df0ca6ad2ad85b1e6649b0307b9
1 file changed +13
tests/ui-control-structure.test.mjs
+13
@@ -79,6 +79,13 @@ test('Q01: menu controls remain keyboard-reachable with synchronized screen-read
79 assert.match(main, /aria-expanded/);
80 assert.match(router, /aria-current/);
81 assert.match(styles, /:focus-visible/);
82 + const desktopToggle = styles.match(/\.hamburger\s*\{([^}]*)\}/)?.[1];
83 + assert.ok(desktopToggle, 'desktop sidebar toggle styles not found');
84 + assert.match(desktopToggle, /display:\s*inline-flex\s*;/,
85 + 'the sidebar toggle must be visible/focusable on desktop as well as mobile');
86 + assert.doesNotMatch(desktopToggle, /display:\s*none\s*;/);
87 + const nativeAudit = fs.readFileSync(path.join(root,'tests','windows-vm-ui-interaction-audit-browser.js'),'utf8');
88 + assert.match(nativeAudit, /Desktop sidebar toggle cannot receive keyboard focus/);
89 });
90
91 test('Q01: shared dialogs have ARIA naming, keyboard dismissal and focus restoration contracts', () => {
@@ -89,6 +96,10 @@ test('Q01: shared dialogs have ARIA naming, keyboard dismissal and focus restora
96 assert.match(code, /event\.key === 'Escape'/);
97 assert.match(code, /event\.key !== 'Tab'/);
98 assert.match(code, /previousFocus\.focus/);
99 + assert.match(code, /\[data-confirm-message\]'\)\.textContent = String\(message \?\? ''\)/,
100 + 'untrusted confirmation messages must be assigned as text, not HTML');
101 + assert.doesNotMatch(code, /\$\{message\}<\/p>/,
102 + 'financial confirmation message must never be interpolated into innerHTML');
103 assert.match(code, /addEventListener\('keydown'/);
104 assert.match(code, /removeEventListener\('keydown'/);
105 });
@@ -121,6 +132,8 @@ test('Q01: installed WebView2 must click synthetic modal Cancel/Confirm and trap
132 'cancelDoesNotConfirmAndRestoresFocus:true',
133 'syntheticConfirmRunsExactlyOnce:true',
134 'syntheticConfirmed!==0','syntheticConfirmed!==1',
135 + 'confirmationTextEscaped:true',
136 + 'Confirmation message was interpreted as executable HTML',
137 'tabForward.defaultPrevented','tabBackward.defaultPrevented'
138 ]) assert.ok(audit.includes(check),'native modal control evidence missing: '+check);
139 for(const check of [