sibujs 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1630 -0
- package/dist/browser.cjs +815 -0
- package/dist/browser.d.cts +174 -0
- package/dist/browser.d.ts +174 -0
- package/dist/browser.js +458 -0
- package/dist/build.cjs +4970 -0
- package/dist/build.d.cts +630 -0
- package/dist/build.d.ts +630 -0
- package/dist/build.js +2478 -0
- package/dist/cdn.global.js +115 -0
- package/dist/chunk-27QC4FPL.js +67 -0
- package/dist/chunk-2ABBWCGC.js +65 -0
- package/dist/chunk-2MUNQYZ7.js +26 -0
- package/dist/chunk-2PSPKNUI.js +1711 -0
- package/dist/chunk-35CDLDX5.js +1758 -0
- package/dist/chunk-36MU4CFV.js +41 -0
- package/dist/chunk-3FIQOFI6.js +182 -0
- package/dist/chunk-3GHNC2BN.js +28 -0
- package/dist/chunk-3HLWWEPU.js +909 -0
- package/dist/chunk-3IVI3J54.js +252 -0
- package/dist/chunk-3KZ72WNW.js +944 -0
- package/dist/chunk-4AU64SQV.js +182 -0
- package/dist/chunk-4MOK7HAR.js +84 -0
- package/dist/chunk-4QK6FBDH.js +1429 -0
- package/dist/chunk-566Z7HXB.js +737 -0
- package/dist/chunk-5CRBB7XP.js +358 -0
- package/dist/chunk-5G67D3IZ.js +168 -0
- package/dist/chunk-5NCPAWBE.js +99 -0
- package/dist/chunk-5O2RKXR3.js +1444 -0
- package/dist/chunk-6BTBDO6A.js +633 -0
- package/dist/chunk-6IWEHW57.js +43 -0
- package/dist/chunk-6JGMNCD6.js +282 -0
- package/dist/chunk-6QRLJNXR.js +1425 -0
- package/dist/chunk-7HM5UE5T.js +270 -0
- package/dist/chunk-7JOLTGUH.js +58 -0
- package/dist/chunk-7MCWJCQK.js +909 -0
- package/dist/chunk-7RIIFP3E.js +1758 -0
- package/dist/chunk-7UASYN3G.js +254 -0
- package/dist/chunk-7W2WYHDI.js +741 -0
- package/dist/chunk-7Y35RDSJ.js +872 -0
- package/dist/chunk-A65GFJBL.js +65 -0
- package/dist/chunk-AD6ZIEDK.js +67 -0
- package/dist/chunk-AK5Y72F3.js +1426 -0
- package/dist/chunk-APOMMWH4.js +282 -0
- package/dist/chunk-ARZVTWIQ.js +1750 -0
- package/dist/chunk-AWWBM2BI.js +664 -0
- package/dist/chunk-AX5VEQTY.js +58 -0
- package/dist/chunk-AYTXVOW3.js +1708 -0
- package/dist/chunk-BG4A246G.js +1746 -0
- package/dist/chunk-BNFJJA2L.js +1425 -0
- package/dist/chunk-BPKPBVU5.js +59 -0
- package/dist/chunk-BPKPPSXC.js +282 -0
- package/dist/chunk-BPWKKK7F.js +1711 -0
- package/dist/chunk-CCKX6YTC.js +1735 -0
- package/dist/chunk-CIF5Z3MP.js +58 -0
- package/dist/chunk-CSXYU7IO.js +457 -0
- package/dist/chunk-D6JD4FDC.js +26 -0
- package/dist/chunk-E7NGA7X2.js +59 -0
- package/dist/chunk-EEPPJKAE.js +443 -0
- package/dist/chunk-EJMYGAGQ.js +717 -0
- package/dist/chunk-EL6Z5MDY.js +55 -0
- package/dist/chunk-EP7VRLEB.js +41 -0
- package/dist/chunk-ETMEC6FH.js +99 -0
- package/dist/chunk-EZ2WHYVL.js +65 -0
- package/dist/chunk-EZRVMSZK.js +67 -0
- package/dist/chunk-F2TRGINX.js +254 -0
- package/dist/chunk-F5JCIH3Q.js +642 -0
- package/dist/chunk-FGK3JKMN.js +909 -0
- package/dist/chunk-FQWPKSTD.js +1437 -0
- package/dist/chunk-FWHVLMCI.js +26 -0
- package/dist/chunk-GBEYQRO2.js +303 -0
- package/dist/chunk-GBLES3NK.js +248 -0
- package/dist/chunk-GQVGUQW6.js +1436 -0
- package/dist/chunk-HCV2T76T.js +457 -0
- package/dist/chunk-HS7ZKVPR.js +182 -0
- package/dist/chunk-HXDVV7HZ.js +909 -0
- package/dist/chunk-IB23VMO3.js +1746 -0
- package/dist/chunk-IEMZ7RTT.js +99 -0
- package/dist/chunk-IPGRSN42.js +1750 -0
- package/dist/chunk-IVMOK2QN.js +1750 -0
- package/dist/chunk-JCLGQO7T.js +443 -0
- package/dist/chunk-JDXL7KDB.js +1436 -0
- package/dist/chunk-JIIFW636.js +270 -0
- package/dist/chunk-JWGEEH7H.js +944 -0
- package/dist/chunk-K2BESAG7.js +1688 -0
- package/dist/chunk-K2U5YGF4.js +877 -0
- package/dist/chunk-K45FQ4Y4.js +175 -0
- package/dist/chunk-K7BPE427.js +1432 -0
- package/dist/chunk-KL3266RS.js +26 -0
- package/dist/chunk-KNN4P7DZ.js +84 -0
- package/dist/chunk-KP2DZH5Q.js +254 -0
- package/dist/chunk-KZHAJSQR.js +1636 -0
- package/dist/chunk-LBKGHMQV.js +1750 -0
- package/dist/chunk-LBTEPL7A.js +1731 -0
- package/dist/chunk-LEBBPTDB.js +1444 -0
- package/dist/chunk-LLH63WVQ.js +98 -0
- package/dist/chunk-LWVR2C4G.js +1711 -0
- package/dist/chunk-M3MDTVV2.js +896 -0
- package/dist/chunk-M5GNLDEO.js +303 -0
- package/dist/chunk-MFHVGKET.js +267 -0
- package/dist/chunk-MGWSG3PM.js +358 -0
- package/dist/chunk-MJNB47HB.js +19 -0
- package/dist/chunk-MLKGABMK.js +9 -0
- package/dist/chunk-MQWTY3JY.js +944 -0
- package/dist/chunk-MZZOQHNI.js +642 -0
- package/dist/chunk-NIHWGZS4.js +1426 -0
- package/dist/chunk-NSVVHQK5.js +41 -0
- package/dist/chunk-NVI2WE7D.js +443 -0
- package/dist/chunk-O7QBO3PH.js +58 -0
- package/dist/chunk-OAUPQBO2.js +270 -0
- package/dist/chunk-OB2LMD7C.js +297 -0
- package/dist/chunk-OHEYBWQU.js +58 -0
- package/dist/chunk-OI6OXUHJ.js +443 -0
- package/dist/chunk-OX2VMRMV.js +633 -0
- package/dist/chunk-P4FYE5TX.js +866 -0
- package/dist/chunk-P5KFWM4H.js +98 -0
- package/dist/chunk-PUMLE7RJ.js +1711 -0
- package/dist/chunk-Q4MFANBF.js +282 -0
- package/dist/chunk-QLEKZMMU.js +282 -0
- package/dist/chunk-RGGNGVO3.js +98 -0
- package/dist/chunk-RKJDRVV6.js +443 -0
- package/dist/chunk-S5BHU353.js +43 -0
- package/dist/chunk-SHQUSFH7.js +1426 -0
- package/dist/chunk-SMB4DBMD.js +182 -0
- package/dist/chunk-SNYHQP3D.js +743 -0
- package/dist/chunk-T24L3TBF.js +1717 -0
- package/dist/chunk-TAQNSOKT.js +692 -0
- package/dist/chunk-TDNY4SUA.js +41 -0
- package/dist/chunk-TNNF56IQ.js +1750 -0
- package/dist/chunk-TR7E6LYX.js +457 -0
- package/dist/chunk-URWUFH45.js +98 -0
- package/dist/chunk-UUSIH3XH.js +1429 -0
- package/dist/chunk-UYFNXLKR.js +1436 -0
- package/dist/chunk-V6F7KUWD.js +270 -0
- package/dist/chunk-VCZLXRMR.js +254 -0
- package/dist/chunk-VDHXSSBT.js +1426 -0
- package/dist/chunk-VM4QMKVK.js +254 -0
- package/dist/chunk-VWGYKYL2.js +737 -0
- package/dist/chunk-VX2OFBJN.js +1426 -0
- package/dist/chunk-VXVIE6DG.js +84 -0
- package/dist/chunk-W4OH7HG4.js +40 -0
- package/dist/chunk-WBVJX4GZ.js +98 -0
- package/dist/chunk-WDU2ZV4I.js +1426 -0
- package/dist/chunk-X6VUCICU.js +457 -0
- package/dist/chunk-XAY7FM7Y.js +618 -0
- package/dist/chunk-XJZ5Z2CM.js +642 -0
- package/dist/chunk-XKVFQTJJ.js +254 -0
- package/dist/chunk-XRLFASCY.js +22 -0
- package/dist/chunk-XYU6TZOW.js +182 -0
- package/dist/chunk-Y745CBVB.js +944 -0
- package/dist/chunk-YLBJSXYY.js +944 -0
- package/dist/chunk-YQJIKVPZ.js +1429 -0
- package/dist/chunk-YRM2VCZF.js +457 -0
- package/dist/chunk-YS33KBVJ.js +944 -0
- package/dist/chunk-Z27DZPDG.js +41 -0
- package/dist/chunk-ZXQ5NAEN.js +32 -0
- package/dist/contracts-B552GopR.d.cts +245 -0
- package/dist/contracts-B552GopR.d.ts +245 -0
- package/dist/contracts-Bg1ECISC.d.cts +245 -0
- package/dist/contracts-Bg1ECISC.d.ts +245 -0
- package/dist/contracts-CMriKJ6P.d.cts +245 -0
- package/dist/contracts-CMriKJ6P.d.ts +245 -0
- package/dist/contracts-DOrhwbke.d.cts +245 -0
- package/dist/contracts-DOrhwbke.d.ts +245 -0
- package/dist/data.cjs +1373 -0
- package/dist/data.d.cts +434 -0
- package/dist/data.d.ts +434 -0
- package/dist/data.js +945 -0
- package/dist/devtools.cjs +1357 -0
- package/dist/devtools.d.cts +473 -0
- package/dist/devtools.d.ts +473 -0
- package/dist/devtools.js +1084 -0
- package/dist/ecosystem.cjs +1046 -0
- package/dist/ecosystem.d.cts +247 -0
- package/dist/ecosystem.d.ts +247 -0
- package/dist/ecosystem.js +369 -0
- package/dist/extras.cjs +8457 -0
- package/dist/extras.d.cts +2356 -0
- package/dist/extras.d.ts +2356 -0
- package/dist/extras.js +5152 -0
- package/dist/index.cjs +2648 -0
- package/dist/index.d.cts +869 -0
- package/dist/index.d.ts +869 -0
- package/dist/index.js +386 -0
- package/dist/motion.cjs +604 -0
- package/dist/motion.d.cts +146 -0
- package/dist/motion.d.ts +146 -0
- package/dist/motion.js +346 -0
- package/dist/patterns.cjs +815 -0
- package/dist/patterns.d.cts +163 -0
- package/dist/patterns.d.ts +163 -0
- package/dist/patterns.js +296 -0
- package/dist/performance.cjs +927 -0
- package/dist/performance.d.cts +416 -0
- package/dist/performance.d.ts +416 -0
- package/dist/performance.js +654 -0
- package/dist/plugins.cjs +2487 -0
- package/dist/plugins.d.cts +393 -0
- package/dist/plugins.d.ts +393 -0
- package/dist/plugins.js +1504 -0
- package/dist/signal-BnWpq6WB.d.cts +5 -0
- package/dist/signal-BnWpq6WB.d.ts +5 -0
- package/dist/src/components/ErrorBoundary.d.ts +15 -0
- package/dist/src/components/ErrorBoundary.js +119 -0
- package/dist/src/core/catch.d.ts +11 -0
- package/dist/src/core/catch.js +28 -0
- package/dist/src/core/each.d.ts +13 -0
- package/dist/src/core/each.js +68 -0
- package/dist/src/core/for.d.ts +12 -0
- package/dist/src/core/for.js +67 -0
- package/dist/src/core/html.d.ts +137 -0
- package/dist/src/core/html.js +155 -0
- package/dist/src/core/htmlIf.d.ts +11 -0
- package/dist/src/core/htmlIf.js +18 -0
- package/dist/src/core/lazy.d.ts +7 -0
- package/dist/src/core/lazy.js +16 -0
- package/dist/src/core/mount.d.ts +7 -0
- package/dist/src/core/mount.js +12 -0
- package/dist/src/core/slots.d.ts +3 -0
- package/dist/src/core/slots.js +3 -0
- package/dist/src/core/suspense.d.ts +10 -0
- package/dist/src/core/suspense.js +33 -0
- package/dist/src/core/tagFactory.d.ts +13 -0
- package/dist/src/core/tagFactory.js +86 -0
- package/dist/src/core/test.d.ts +11 -0
- package/dist/src/core/test.js +28 -0
- package/dist/src/core/types.d.ts +2 -0
- package/dist/src/core/types.js +1 -0
- package/dist/src/core/useComputed.d.ts +6 -0
- package/dist/src/core/useComputed.js +30 -0
- package/dist/src/core/useEffect.d.ts +6 -0
- package/dist/src/core/useEffect.js +23 -0
- package/dist/src/core/useState.d.ts +10 -0
- package/dist/src/core/useState.js +34 -0
- package/dist/src/core/useStore.d.ts +19 -0
- package/dist/src/core/useStore.js +53 -0
- package/dist/src/core/useWatch.d.ts +8 -0
- package/dist/src/core/useWatch.js +23 -0
- package/dist/src/plugins/i18n.d.ts +6 -0
- package/dist/src/plugins/i18n.js +16 -0
- package/dist/src/plugins/router.d.ts +188 -0
- package/dist/src/plugins/router.js +1178 -0
- package/dist/src/reactivity/bindAttribute.d.ts +5 -0
- package/dist/src/reactivity/bindAttribute.js +31 -0
- package/dist/src/reactivity/bindChildNode.d.ts +10 -0
- package/dist/src/reactivity/bindChildNode.js +46 -0
- package/dist/src/reactivity/bindTextNode.d.ts +10 -0
- package/dist/src/reactivity/bindTextNode.js +27 -0
- package/dist/src/reactivity/signal.d.ts +3 -0
- package/dist/src/reactivity/signal.js +1 -0
- package/dist/src/reactivity/track.d.ts +18 -0
- package/dist/src/reactivity/track.js +73 -0
- package/dist/src/reactivity/useComputed.d.ts +6 -0
- package/dist/src/reactivity/useComputed.js +30 -0
- package/dist/src/reactivity/useEffect.d.ts +6 -0
- package/dist/src/reactivity/useEffect.js +23 -0
- package/dist/src/reactivity/useState.d.ts +10 -0
- package/dist/src/reactivity/useState.js +34 -0
- package/dist/src/reactivity/useStore.d.ts +19 -0
- package/dist/src/reactivity/useStore.js +53 -0
- package/dist/src/reactivity/useWatch.d.ts +8 -0
- package/dist/src/reactivity/useWatch.js +23 -0
- package/dist/src/utils/sanitize.d.ts +1 -0
- package/dist/src/utils/sanitize.js +8 -0
- package/dist/ssr-27FOM46T.js +35 -0
- package/dist/ssr-GFUTTSJD.js +22 -0
- package/dist/ssr-K7DCR6BZ.js +35 -0
- package/dist/ssr-O6LFMRFP.js +35 -0
- package/dist/ssr-QZEVGMMK.js +35 -0
- package/dist/ssr-SGVBCAGC.js +35 -0
- package/dist/ssr-UB2IXCYX.js +35 -0
- package/dist/ssr-XBZQNV4O.js +22 -0
- package/dist/ssr-Y76FSXDU.js +35 -0
- package/dist/ssr-YQJ4AYBD.js +35 -0
- package/dist/ssr.cjs +1757 -0
- package/dist/ssr.d.cts +478 -0
- package/dist/ssr.d.ts +478 -0
- package/dist/ssr.js +743 -0
- package/dist/tagFactory-CZPO4RXF.d.cts +34 -0
- package/dist/tagFactory-CZPO4RXF.d.ts +34 -0
- package/dist/tagFactory-CgImPVMY.d.cts +22 -0
- package/dist/tagFactory-CgImPVMY.d.ts +22 -0
- package/dist/tagFactory-Cw1iv5if.d.cts +22 -0
- package/dist/tagFactory-Cw1iv5if.d.ts +22 -0
- package/dist/tagFactory-DeAXq9ef.d.cts +30 -0
- package/dist/tagFactory-DeAXq9ef.d.ts +30 -0
- package/dist/tagFactory-SkY0a7L1.d.cts +22 -0
- package/dist/tagFactory-SkY0a7L1.d.ts +22 -0
- package/dist/testing.cjs +1919 -0
- package/dist/testing.d.cts +491 -0
- package/dist/testing.d.ts +491 -0
- package/dist/testing.js +1862 -0
- package/dist/ui.cjs +1497 -0
- package/dist/ui.d.cts +264 -0
- package/dist/ui.d.ts +264 -0
- package/dist/ui.js +900 -0
- package/dist/widgets.cjs +919 -0
- package/dist/widgets.d.cts +165 -0
- package/dist/widgets.d.ts +165 -0
- package/dist/widgets.js +545 -0
- package/package.json +134 -0
|
@@ -0,0 +1,491 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Accessibility testing utilities for SibuJS.
|
|
3
|
+
* Provides automated a11y checks and WCAG compliance validation.
|
|
4
|
+
*/
|
|
5
|
+
type A11yViolationLevel = "error" | "warning" | "info";
|
|
6
|
+
interface A11yViolation {
|
|
7
|
+
rule: string;
|
|
8
|
+
level: A11yViolationLevel;
|
|
9
|
+
message: string;
|
|
10
|
+
element?: Element;
|
|
11
|
+
selector?: string;
|
|
12
|
+
}
|
|
13
|
+
interface A11yCheckResult {
|
|
14
|
+
passed: boolean;
|
|
15
|
+
violations: A11yViolation[];
|
|
16
|
+
warnings: A11yViolation[];
|
|
17
|
+
info: A11yViolation[];
|
|
18
|
+
summary: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Check that all images have alt text.
|
|
22
|
+
*/
|
|
23
|
+
declare function checkImageAlt(root: Element): A11yViolation[];
|
|
24
|
+
/**
|
|
25
|
+
* Check that form inputs have associated labels.
|
|
26
|
+
* Checks for: <label for="id">, aria-label, aria-labelledby, wrapping <label>.
|
|
27
|
+
*/
|
|
28
|
+
declare function checkFormLabels(root: Element): A11yViolation[];
|
|
29
|
+
/**
|
|
30
|
+
* Check heading hierarchy (h1-h6 should not skip levels).
|
|
31
|
+
*/
|
|
32
|
+
declare function checkHeadingHierarchy(root: Element): A11yViolation[];
|
|
33
|
+
/**
|
|
34
|
+
* Check for sufficient color contrast ratios.
|
|
35
|
+
* Since we can't compute actual colors in jsdom, checks for known issues:
|
|
36
|
+
* - Text with no color/background set
|
|
37
|
+
* - Elements with role but no accessible name
|
|
38
|
+
*/
|
|
39
|
+
declare function checkColorContrast(root: Element): A11yViolation[];
|
|
40
|
+
/**
|
|
41
|
+
* Check that interactive elements are keyboard accessible.
|
|
42
|
+
* Elements with click handlers should have tabindex, role, and key handlers.
|
|
43
|
+
*/
|
|
44
|
+
declare function checkKeyboardAccess(root: Element): A11yViolation[];
|
|
45
|
+
/**
|
|
46
|
+
* Check ARIA attribute validity.
|
|
47
|
+
* - role attributes use valid ARIA roles
|
|
48
|
+
* - aria-* attributes are valid
|
|
49
|
+
* - Required aria properties are present for roles
|
|
50
|
+
*/
|
|
51
|
+
declare function checkAriaAttributes(root: Element): A11yViolation[];
|
|
52
|
+
/**
|
|
53
|
+
* Check that the page has proper landmark regions.
|
|
54
|
+
*/
|
|
55
|
+
declare function checkLandmarks(root: Element): A11yViolation[];
|
|
56
|
+
/**
|
|
57
|
+
* Check link and button accessibility.
|
|
58
|
+
* - Links should have discernible text
|
|
59
|
+
* - Buttons should have accessible names
|
|
60
|
+
* - Links with target="_blank" should warn about new window
|
|
61
|
+
*/
|
|
62
|
+
declare function checkLinksAndButtons(root: Element): A11yViolation[];
|
|
63
|
+
/**
|
|
64
|
+
* Check that lists use proper semantic markup.
|
|
65
|
+
*/
|
|
66
|
+
declare function checkListSemantics(root: Element): A11yViolation[];
|
|
67
|
+
/**
|
|
68
|
+
* Check for tab order issues.
|
|
69
|
+
* - Positive tabindex values (anti-pattern)
|
|
70
|
+
* - Focus traps without escape mechanism
|
|
71
|
+
*/
|
|
72
|
+
declare function checkTabOrder(root: Element): A11yViolation[];
|
|
73
|
+
type CheckName = "images" | "forms" | "headings" | "contrast" | "keyboard" | "aria" | "landmarks" | "links" | "lists" | "tabOrder";
|
|
74
|
+
/**
|
|
75
|
+
* Run all accessibility checks on an element.
|
|
76
|
+
* Returns a comprehensive report.
|
|
77
|
+
*/
|
|
78
|
+
declare function checkA11y(root: Element, options?: {
|
|
79
|
+
/** Which checks to run (default: all) */
|
|
80
|
+
checks?: CheckName[];
|
|
81
|
+
/** Minimum violation level to report */
|
|
82
|
+
level?: A11yViolationLevel;
|
|
83
|
+
}): A11yCheckResult;
|
|
84
|
+
/**
|
|
85
|
+
* Assert that an element has no accessibility violations.
|
|
86
|
+
* Throws with a detailed report if violations are found.
|
|
87
|
+
*/
|
|
88
|
+
declare function assertA11y(root: Element, options?: Parameters<typeof checkA11y>[1]): void;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Testing framework adapters for SibuJS.
|
|
92
|
+
* Provides integration with Jest, Cypress, and Playwright.
|
|
93
|
+
*/
|
|
94
|
+
/**
|
|
95
|
+
* Create a Jest-compatible test environment for SibuJS.
|
|
96
|
+
* Returns beforeEach/afterEach hooks and custom matchers.
|
|
97
|
+
*/
|
|
98
|
+
declare function createJestAdapter(): {
|
|
99
|
+
/** Call in beforeEach to set up DOM container */
|
|
100
|
+
setup(): HTMLElement;
|
|
101
|
+
/** Call in afterEach to clean up */
|
|
102
|
+
teardown(): void;
|
|
103
|
+
/** Render a component into the test container */
|
|
104
|
+
render(component: (() => HTMLElement) | HTMLElement): {
|
|
105
|
+
element: HTMLElement;
|
|
106
|
+
container: HTMLElement;
|
|
107
|
+
};
|
|
108
|
+
/** Custom Jest matchers */
|
|
109
|
+
matchers: {
|
|
110
|
+
/** Check if element has specific text content */
|
|
111
|
+
toHaveTextContent(element: Element, expected: string): {
|
|
112
|
+
pass: boolean;
|
|
113
|
+
message: () => string;
|
|
114
|
+
};
|
|
115
|
+
/** Check if element has specific attribute */
|
|
116
|
+
toHaveAttribute(element: Element, attr: string, value?: string): {
|
|
117
|
+
pass: boolean;
|
|
118
|
+
message: () => string;
|
|
119
|
+
};
|
|
120
|
+
/** Check if element has specific class */
|
|
121
|
+
toHaveClass(element: Element, className: string): {
|
|
122
|
+
pass: boolean;
|
|
123
|
+
message: () => string;
|
|
124
|
+
};
|
|
125
|
+
/** Check if element is visible (no display:none, visibility:hidden, hidden attr) */
|
|
126
|
+
toBeVisible(element: Element): {
|
|
127
|
+
pass: boolean;
|
|
128
|
+
message: () => string;
|
|
129
|
+
};
|
|
130
|
+
/** Check if element is disabled */
|
|
131
|
+
toBeDisabled(element: Element): {
|
|
132
|
+
pass: boolean;
|
|
133
|
+
message: () => string;
|
|
134
|
+
};
|
|
135
|
+
/** Check if element has focus */
|
|
136
|
+
toHaveFocus(element: Element): {
|
|
137
|
+
pass: boolean;
|
|
138
|
+
message: () => string;
|
|
139
|
+
};
|
|
140
|
+
/** Check if element has specific style */
|
|
141
|
+
toHaveStyle(element: HTMLElement, style: Record<string, string>): {
|
|
142
|
+
pass: boolean;
|
|
143
|
+
message: () => string;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Create a Cypress-compatible component mounting helper.
|
|
149
|
+
* Returns utilities for mounting SibuJS components in Cypress tests.
|
|
150
|
+
*/
|
|
151
|
+
declare function createCypressAdapter(): {
|
|
152
|
+
/** Mount a component for Cypress component testing */
|
|
153
|
+
mount(component: (() => HTMLElement) | HTMLElement, options?: {
|
|
154
|
+
container?: HTMLElement;
|
|
155
|
+
}): {
|
|
156
|
+
element: HTMLElement;
|
|
157
|
+
container: HTMLElement;
|
|
158
|
+
};
|
|
159
|
+
/** Generate Cypress custom commands for SibuJS */
|
|
160
|
+
commands: {
|
|
161
|
+
/** Find by data-testid */
|
|
162
|
+
getByTestId: (id: string) => string;
|
|
163
|
+
/** Find by text */
|
|
164
|
+
getByText: (text: string) => string;
|
|
165
|
+
/** Find by role */
|
|
166
|
+
getByRole: (role: string) => string;
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
/**
|
|
170
|
+
* Create a Playwright-compatible test helper.
|
|
171
|
+
* Provides page object patterns for SibuJS components.
|
|
172
|
+
*/
|
|
173
|
+
declare function createPlaywrightAdapter(): {
|
|
174
|
+
/** Selectors for common SibuJS patterns */
|
|
175
|
+
selectors: {
|
|
176
|
+
byTestId: (id: string) => string;
|
|
177
|
+
byRole: (role: string) => string;
|
|
178
|
+
byAriaLabel: (label: string) => string;
|
|
179
|
+
byDataAttr: (attr: string, value?: string) => string;
|
|
180
|
+
};
|
|
181
|
+
/** Generate a page object for a SibuJS component */
|
|
182
|
+
createPageObject(name: string, selectors: Record<string, string>): {
|
|
183
|
+
name: string;
|
|
184
|
+
getSelector: (key: string) => string;
|
|
185
|
+
allSelectors: () => Record<string, string>;
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
/**
|
|
189
|
+
* Framework-agnostic test adapter that works with any testing framework.
|
|
190
|
+
*/
|
|
191
|
+
declare function createUniversalAdapter(): {
|
|
192
|
+
/** Setup test environment */
|
|
193
|
+
setup(): HTMLElement;
|
|
194
|
+
/** Teardown test environment */
|
|
195
|
+
teardown(): void;
|
|
196
|
+
/** Render component */
|
|
197
|
+
render(component: (() => HTMLElement) | HTMLElement): {
|
|
198
|
+
element: HTMLElement;
|
|
199
|
+
container: HTMLElement;
|
|
200
|
+
};
|
|
201
|
+
/** Query helpers */
|
|
202
|
+
queries: {
|
|
203
|
+
byTestId(container: Element, id: string): Element | null;
|
|
204
|
+
byRole(container: Element, role: string): Element | null;
|
|
205
|
+
byText(container: Element, text: string): Element | null;
|
|
206
|
+
byLabelText(container: Element, label: string): Element | null;
|
|
207
|
+
allByRole(container: Element, role: string): Element[];
|
|
208
|
+
};
|
|
209
|
+
/** Assertion helpers */
|
|
210
|
+
assert: {
|
|
211
|
+
textContent(el: Element, expected: string): void;
|
|
212
|
+
attribute(el: Element, attr: string, value?: string): void;
|
|
213
|
+
visible(el: Element): void;
|
|
214
|
+
disabled(el: Element): void;
|
|
215
|
+
className(el: Element, name: string): void;
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* E2E testing utilities and mocks for SibuJS.
|
|
221
|
+
* Provides DOM fakes, HTTP mocks, and testing helpers for CI/CD integration.
|
|
222
|
+
*/
|
|
223
|
+
interface MockResponse {
|
|
224
|
+
status?: number;
|
|
225
|
+
statusText?: string;
|
|
226
|
+
headers?: Record<string, string>;
|
|
227
|
+
body?: unknown;
|
|
228
|
+
/** Delay before responding in ms */
|
|
229
|
+
delay?: number;
|
|
230
|
+
}
|
|
231
|
+
interface MockRoute {
|
|
232
|
+
method?: string;
|
|
233
|
+
url: string | RegExp;
|
|
234
|
+
response: MockResponse | ((req: {
|
|
235
|
+
url: string;
|
|
236
|
+
method: string;
|
|
237
|
+
body: unknown;
|
|
238
|
+
headers: Headers;
|
|
239
|
+
}) => MockResponse | Promise<MockResponse>);
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Create an HTTP mock server that intercepts fetch calls.
|
|
243
|
+
* Useful for testing components that make API calls.
|
|
244
|
+
*/
|
|
245
|
+
declare function createHttpMock(routes?: MockRoute[]): {
|
|
246
|
+
/** Install the mock (replace global fetch) */
|
|
247
|
+
install(): void;
|
|
248
|
+
/** Restore original fetch */
|
|
249
|
+
restore(): void;
|
|
250
|
+
/** Add a mock route */
|
|
251
|
+
addRoute(route: MockRoute): void;
|
|
252
|
+
/** Remove all mock routes */
|
|
253
|
+
clearRoutes(): void;
|
|
254
|
+
/** Get the request log */
|
|
255
|
+
getRequests(): {
|
|
256
|
+
url: string;
|
|
257
|
+
method: string;
|
|
258
|
+
body: unknown;
|
|
259
|
+
timestamp: number;
|
|
260
|
+
}[];
|
|
261
|
+
/** Clear the request log */
|
|
262
|
+
clearLog(): void;
|
|
263
|
+
/** Assert that a URL was called */
|
|
264
|
+
assertCalled(url: string, method?: string): void;
|
|
265
|
+
/** Assert that a URL was NOT called */
|
|
266
|
+
assertNotCalled(url: string, method?: string): void;
|
|
267
|
+
/** Get number of times a URL was called */
|
|
268
|
+
callCount(url: string, method?: string): number;
|
|
269
|
+
};
|
|
270
|
+
/**
|
|
271
|
+
* Create a fake timer system for testing time-dependent code.
|
|
272
|
+
* Mocks setTimeout, setInterval, requestAnimationFrame.
|
|
273
|
+
*/
|
|
274
|
+
declare function createTimerMock(): {
|
|
275
|
+
install(): void;
|
|
276
|
+
restore(): void;
|
|
277
|
+
/** Advance time by a given number of ms, running any timers that fire */
|
|
278
|
+
advance(ms: number): void;
|
|
279
|
+
/** Run all pending timers immediately */
|
|
280
|
+
flush(): void;
|
|
281
|
+
/** Get current fake time */
|
|
282
|
+
now(): number;
|
|
283
|
+
/** Get number of pending timers */
|
|
284
|
+
pendingCount(): number;
|
|
285
|
+
};
|
|
286
|
+
/**
|
|
287
|
+
* Create a serializable snapshot of a DOM element for comparison testing.
|
|
288
|
+
*/
|
|
289
|
+
declare function createDOMSnapshot(element: Element): string;
|
|
290
|
+
/**
|
|
291
|
+
* Assert that two DOM trees are structurally equivalent.
|
|
292
|
+
*/
|
|
293
|
+
declare function assertDOMEquals(actual: Element, expected: Element): void;
|
|
294
|
+
/**
|
|
295
|
+
* Wrap a component for isolated testing with automatic cleanup.
|
|
296
|
+
*/
|
|
297
|
+
declare function testComponent(component: (() => HTMLElement) | HTMLElement, options?: {
|
|
298
|
+
container?: HTMLElement;
|
|
299
|
+
}): {
|
|
300
|
+
element: HTMLElement;
|
|
301
|
+
container: HTMLElement;
|
|
302
|
+
/** Find element by test ID (data-testid attribute) */
|
|
303
|
+
getByTestId: (id: string) => Element | null;
|
|
304
|
+
/** Find all elements by test ID */
|
|
305
|
+
getAllByTestId: (id: string) => Element[];
|
|
306
|
+
/** Find by text content */
|
|
307
|
+
getByText: (text: string) => Element | null;
|
|
308
|
+
/** Simulate click */
|
|
309
|
+
click: (el: Element) => void;
|
|
310
|
+
/** Simulate input */
|
|
311
|
+
type: (el: HTMLInputElement, value: string) => void;
|
|
312
|
+
/** Wait for reactive updates */
|
|
313
|
+
waitForUpdate: () => Promise<void>;
|
|
314
|
+
/** Clean up */
|
|
315
|
+
destroy: () => void;
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Snapshot testing utilities for SibuJS components.
|
|
320
|
+
* Capture and compare component output over time.
|
|
321
|
+
*/
|
|
322
|
+
/**
|
|
323
|
+
* Snapshot store for managing saved snapshots.
|
|
324
|
+
* In a real environment, these would be persisted to disk by the test framework.
|
|
325
|
+
* This provides the in-memory API that adapters can hook into.
|
|
326
|
+
*/
|
|
327
|
+
declare function createSnapshotStore(): {
|
|
328
|
+
/** Save a snapshot with a given name */
|
|
329
|
+
save: (name: string, snapshot: string) => void;
|
|
330
|
+
/** Get a saved snapshot */
|
|
331
|
+
get: (name: string) => string | undefined;
|
|
332
|
+
/** Check if a snapshot exists */
|
|
333
|
+
has: (name: string) => boolean;
|
|
334
|
+
/** Compare a snapshot against a saved one. Returns null if match, diff string if mismatch */
|
|
335
|
+
compare: (name: string, current: string) => {
|
|
336
|
+
match: boolean;
|
|
337
|
+
diff?: string;
|
|
338
|
+
};
|
|
339
|
+
/** Update a saved snapshot */
|
|
340
|
+
update: (name: string, snapshot: string) => void;
|
|
341
|
+
/** Delete a snapshot */
|
|
342
|
+
delete: (name: string) => void;
|
|
343
|
+
/** List all snapshot names */
|
|
344
|
+
list: () => string[];
|
|
345
|
+
/** Clear all snapshots */
|
|
346
|
+
clear: () => void;
|
|
347
|
+
};
|
|
348
|
+
/**
|
|
349
|
+
* Create a serialized snapshot of a SibuJS component.
|
|
350
|
+
* Renders the component and serializes the DOM tree to a deterministic string.
|
|
351
|
+
*/
|
|
352
|
+
declare function snapshotComponent(component: () => HTMLElement): string;
|
|
353
|
+
/**
|
|
354
|
+
* Assert that a component matches its saved snapshot.
|
|
355
|
+
* On first run (no saved snapshot), saves the snapshot.
|
|
356
|
+
* On subsequent runs, compares against the saved snapshot.
|
|
357
|
+
*
|
|
358
|
+
* @param store - The snapshot store to read/write from
|
|
359
|
+
* @param name - A unique name identifying this snapshot
|
|
360
|
+
* @param component - A factory function that creates the component element
|
|
361
|
+
* @param options - Optional: set `update: true` to forcibly overwrite the saved snapshot
|
|
362
|
+
* @returns An object with `passed`, the rendered `snapshot`, and an optional `diff`
|
|
363
|
+
*/
|
|
364
|
+
declare function matchSnapshot(store: ReturnType<typeof createSnapshotStore>, name: string, component: () => HTMLElement, options?: {
|
|
365
|
+
update?: boolean;
|
|
366
|
+
}): {
|
|
367
|
+
passed: boolean;
|
|
368
|
+
snapshot: string;
|
|
369
|
+
diff?: string;
|
|
370
|
+
};
|
|
371
|
+
/**
|
|
372
|
+
* Create a snapshot matcher that auto-generates names based on describe/test context.
|
|
373
|
+
* Provides a convenient API similar to Jest's `toMatchSnapshot()`.
|
|
374
|
+
*
|
|
375
|
+
* @param store - The snapshot store to use for saving/comparing
|
|
376
|
+
*/
|
|
377
|
+
declare function createSnapshotMatcher(store: ReturnType<typeof createSnapshotStore>): {
|
|
378
|
+
/** Assert current component output matches saved snapshot */
|
|
379
|
+
toMatchSnapshot: (component: () => HTMLElement, name?: string) => void;
|
|
380
|
+
/** Update all snapshots in this matcher */
|
|
381
|
+
updateAll: () => void;
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Visual regression testing utilities for SibuJS.
|
|
386
|
+
* Provides structural comparison of component output for detecting UI regressions.
|
|
387
|
+
* In environments without a real browser, uses DOM structure and computed styles.
|
|
388
|
+
*/
|
|
389
|
+
interface VisualFingerprint {
|
|
390
|
+
/** Serialized DOM structure */
|
|
391
|
+
structure: string;
|
|
392
|
+
/** All text content */
|
|
393
|
+
textContent: string;
|
|
394
|
+
/** Count of elements by tag */
|
|
395
|
+
elementCounts: Record<string, number>;
|
|
396
|
+
/** All unique class names used */
|
|
397
|
+
classNames: string[];
|
|
398
|
+
/** All inline styles */
|
|
399
|
+
inlineStyles: string[];
|
|
400
|
+
/** Data attributes */
|
|
401
|
+
dataAttributes: Record<string, string>;
|
|
402
|
+
/** Computed hash of the fingerprint */
|
|
403
|
+
hash: string;
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Capture a visual fingerprint of a component.
|
|
407
|
+
* Includes DOM structure, attributes, text content, and inline styles.
|
|
408
|
+
*/
|
|
409
|
+
declare function captureFingerprint(element: Element): VisualFingerprint;
|
|
410
|
+
interface FingerprintChange {
|
|
411
|
+
type: "structure" | "text" | "class" | "style" | "data" | "elements";
|
|
412
|
+
description: string;
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Compare two visual fingerprints and report differences.
|
|
416
|
+
*/
|
|
417
|
+
declare function compareFingerprints(baseline: VisualFingerprint, current: VisualFingerprint): {
|
|
418
|
+
match: boolean;
|
|
419
|
+
changes: FingerprintChange[];
|
|
420
|
+
};
|
|
421
|
+
/**
|
|
422
|
+
* Create a visual regression test suite.
|
|
423
|
+
* Manages baseline fingerprints and comparison.
|
|
424
|
+
*/
|
|
425
|
+
declare function createVisualSuite(): {
|
|
426
|
+
/** Capture and save a baseline for a component */
|
|
427
|
+
baseline: (name: string, element: Element) => void;
|
|
428
|
+
/** Compare current element against saved baseline */
|
|
429
|
+
check: (name: string, element: Element) => {
|
|
430
|
+
match: boolean;
|
|
431
|
+
changes: FingerprintChange[];
|
|
432
|
+
};
|
|
433
|
+
/** Update a baseline */
|
|
434
|
+
updateBaseline: (name: string, element: Element) => void;
|
|
435
|
+
/** List all baselines */
|
|
436
|
+
list: () => string[];
|
|
437
|
+
/** Clear all baselines */
|
|
438
|
+
clear: () => void;
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* render mounts a component into a test container and returns helpers.
|
|
443
|
+
*/
|
|
444
|
+
declare function render(component: () => HTMLElement): {
|
|
445
|
+
container: HTMLElement;
|
|
446
|
+
element: HTMLElement;
|
|
447
|
+
getByText: (text: string) => HTMLElement | null;
|
|
448
|
+
getByTestId: (testId: string) => HTMLElement | null;
|
|
449
|
+
getByRole: (role: string) => HTMLElement | null;
|
|
450
|
+
queryAll: (selector: string) => HTMLElement[];
|
|
451
|
+
unmount: () => void;
|
|
452
|
+
};
|
|
453
|
+
/**
|
|
454
|
+
* fireEvent dispatches a DOM event on an element.
|
|
455
|
+
*/
|
|
456
|
+
declare function fireEvent(element: HTMLElement, eventName: string, eventInit?: EventInit): boolean;
|
|
457
|
+
declare namespace fireEvent {
|
|
458
|
+
var click: (element: HTMLElement) => boolean;
|
|
459
|
+
var input: (element: HTMLElement, value?: string) => boolean;
|
|
460
|
+
var change: (element: HTMLElement, value?: string) => boolean;
|
|
461
|
+
var submit: (element: HTMLElement) => boolean;
|
|
462
|
+
var keyDown: (element: HTMLElement, key: string, init?: KeyboardEventInit) => boolean;
|
|
463
|
+
var keyUp: (element: HTMLElement, key: string, init?: KeyboardEventInit) => boolean;
|
|
464
|
+
var focus: (element: HTMLElement) => void;
|
|
465
|
+
var blur: (element: HTMLElement) => void;
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* waitFor retries an assertion until it passes or times out.
|
|
469
|
+
*/
|
|
470
|
+
declare function waitFor(callback: () => void, options?: {
|
|
471
|
+
timeout?: number;
|
|
472
|
+
interval?: number;
|
|
473
|
+
}): Promise<void>;
|
|
474
|
+
/**
|
|
475
|
+
* mockRouter creates a mock router for testing route-dependent components.
|
|
476
|
+
*/
|
|
477
|
+
declare function mockRouter(initialPath?: string): {
|
|
478
|
+
currentPath: () => string;
|
|
479
|
+
navigate: (path: string) => void;
|
|
480
|
+
history: string[];
|
|
481
|
+
};
|
|
482
|
+
/**
|
|
483
|
+
* Creates a mock store for testing.
|
|
484
|
+
*/
|
|
485
|
+
declare function mockStore<T extends Record<string, unknown>>(initialState: T): {
|
|
486
|
+
getState: () => T;
|
|
487
|
+
setState: (patch: Partial<T>) => void;
|
|
488
|
+
reset: () => void;
|
|
489
|
+
};
|
|
490
|
+
|
|
491
|
+
export { type A11yCheckResult, type A11yViolation, type A11yViolationLevel, type FingerprintChange, type MockResponse, type MockRoute, type VisualFingerprint, assertA11y, assertDOMEquals, captureFingerprint, checkA11y, checkAriaAttributes, checkColorContrast, checkFormLabels, checkHeadingHierarchy, checkImageAlt, checkKeyboardAccess, checkLandmarks, checkLinksAndButtons, checkListSemantics, checkTabOrder, compareFingerprints, createCypressAdapter, createDOMSnapshot, createHttpMock, createJestAdapter, createPlaywrightAdapter, createSnapshotMatcher, createSnapshotStore, createTimerMock, createUniversalAdapter, createVisualSuite, fireEvent, matchSnapshot, mockRouter, mockStore, render, snapshotComponent, testComponent, waitFor };
|