سامانه صدور فاکتور و حسابداری
test: expose remaining dynamic inline handlers
davoodmehraban89 committed
Oct 2, 2026 at 01:18 UTC
fdbde948abf8e42e0c6e51e7e4ebec66a6dde2da
1 file changed
+3
-1
scripts/pages-artifact.spec.js
+3
-1
@@ -18,7 +18,9 @@ test('hardened Pages artifact loads without script/CSP console errors',async({pa
18
expect(await page.evaluate(()=>window.parseFormattedNumber('١٢٫٥'))).toBe(12.5);
19
const csp=await page.locator('meta[http-equiv="Content-Security-Policy"]').getAttribute('content');
20
expect(csp||'').not.toMatch(/script-src[^;]*'unsafe-inline'/i);
21
- expect(await page.locator('[onclick],[onchange],[oninput],[onsubmit],[onblur],[onfocus]').count()).toBe(0);
21
+ const inline=await page.locator('[onclick],[onchange],[oninput],[onsubmit],[onblur],[onfocus]').evaluateAll(nodes=>nodes.map(el=>({tag:el.tagName,id:el.id||'',attrs:[...el.attributes].filter(a=>/^on/i.test(a.name)).map(a=>[a.name,a.value])})));
22
+ if(inline.length)console.log('REMAINING_INLINE_HANDLERS='+JSON.stringify(inline));
23
+ expect(inline).toEqual([]);
24
const diag=await request.get(base+'diag.html');
25
expect(diag.status()).toBe(404);
26
expect(errors).toEqual([]);