فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
test(ux): enforce accessible modal ARIA, Escape, Tab focus containment and return contracts
davoodmehraban89 committed
Oct 30, 2026 at 23:26 UTC
5d165510ab40f724689d0eed7e3ae73eb556ce2c
1 file changed
+12
tests/ui-control-structure.test.mjs
+12
@@ -77,3 +77,15 @@ test('Q01: menu controls remain keyboard-reachable with synchronized screen-read
77
assert.match(router, /aria-current/);
78
assert.match(styles, /:focus-visible/);
79
});
80
+
81
+test('Q01: shared dialogs have ARIA naming, keyboard dismissal and focus restoration contracts', () => {
82
+ const code = fs.readFileSync(path.join(root, 'src','core','Modal.js'),'utf8');
83
+ assert.match(code, /setAttribute\('role', 'dialog'\)/);
84
+ assert.match(code, /setAttribute\('aria-modal', 'true'\)/);
85
+ assert.match(code, /setAttribute\('aria-labelledby', titleId\)/);
86
+ assert.match(code, /event\.key === 'Escape'/);
87
+ assert.match(code, /event\.key !== 'Tab'/);
88
+ assert.match(code, /previousFocus\.focus/);
89
+ assert.match(code, /addEventListener\('keydown'/);
90
+ assert.match(code, /removeEventListener\('keydown'/);
91
+});