@uuv/a11y 0.0.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.
Files changed (85) hide show
  1. package/LICENSE +24 -0
  2. package/README.md +199 -0
  3. package/bundle/uuv-a11y.bundle.js +3 -0
  4. package/bundle/uuv-a11y.bundle.js.LICENSE.txt +28 -0
  5. package/dist/README.md +199 -0
  6. package/dist/index.d.ts +1 -0
  7. package/dist/index.js +17 -0
  8. package/dist/lib/engine/engine.d.ts +12 -0
  9. package/dist/lib/engine/engine.js +123 -0
  10. package/dist/lib/index.d.ts +3 -0
  11. package/dist/lib/index.js +19 -0
  12. package/dist/lib/model/checker.d.ts +14 -0
  13. package/dist/lib/model/checker.js +35 -0
  14. package/dist/lib/model/index.d.ts +4 -0
  15. package/dist/lib/model/index.js +20 -0
  16. package/dist/lib/model/reference.d.ts +55 -0
  17. package/dist/lib/model/reference.js +66 -0
  18. package/dist/lib/model/result.d.ts +57 -0
  19. package/dist/lib/model/result.js +144 -0
  20. package/dist/lib/model/rule.d.ts +99 -0
  21. package/dist/lib/model/rule.js +53 -0
  22. package/dist/lib/query/00-query.d.ts +4 -0
  23. package/dist/lib/query/00-query.js +2 -0
  24. package/dist/lib/query/accessible-name.query.d.ts +8 -0
  25. package/dist/lib/query/accessible-name.query.js +34 -0
  26. package/dist/lib/query/by-role.query.d.ts +8 -0
  27. package/dist/lib/query/by-role.query.js +27 -0
  28. package/dist/lib/query/by-tag.query.d.ts +7 -0
  29. package/dist/lib/query/by-tag.query.js +20 -0
  30. package/dist/lib/query/doctype.query.d.ts +5 -0
  31. package/dist/lib/query/doctype.query.js +15 -0
  32. package/dist/lib/query/form.query.d.ts +8 -0
  33. package/dist/lib/query/form.query.js +87 -0
  34. package/dist/lib/query/index.d.ts +6 -0
  35. package/dist/lib/query/index.js +22 -0
  36. package/dist/lib/reference/alix/alix-checker.d.ts +0 -0
  37. package/dist/lib/reference/alix/alix-checker.js +82 -0
  38. package/dist/lib/reference/alix/alix-rules.d.ts +0 -0
  39. package/dist/lib/reference/alix/alix-rules.js +1028 -0
  40. package/dist/lib/reference/alix/index.d.ts +0 -0
  41. package/dist/lib/reference/alix/index.js +3 -0
  42. package/dist/lib/reference/index.d.ts +1 -0
  43. package/dist/lib/reference/index.js +18 -0
  44. package/dist/lib/reference/rgaa/common.d.ts +2 -0
  45. package/dist/lib/reference/rgaa/common.js +5 -0
  46. package/dist/lib/reference/rgaa/coverage/coverage-helper.d.ts +2 -0
  47. package/dist/lib/reference/rgaa/coverage/coverage-helper.js +100 -0
  48. package/dist/lib/reference/rgaa/coverage/coverage-statement.json +90 -0
  49. package/dist/lib/reference/rgaa/index.d.ts +2 -0
  50. package/dist/lib/reference/rgaa/index.js +18 -0
  51. package/dist/lib/reference/rgaa/rgaa-checker.d.ts +8 -0
  52. package/dist/lib/reference/rgaa/rgaa-checker.js +31 -0
  53. package/dist/lib/reference/rgaa/rgaa-reference.d.ts +2 -0
  54. package/dist/lib/reference/rgaa/rgaa-reference.js +44 -0
  55. package/dist/lib/reference/rgaa/rgaa_4.1.criteres.json +4144 -0
  56. package/dist/lib/reference/rgaa/rules/1-image.d.ts +14 -0
  57. package/dist/lib/reference/rgaa/rules/1-image.js +644 -0
  58. package/dist/lib/reference/rgaa/rules/10-display.d.ts +2 -0
  59. package/dist/lib/reference/rgaa/rules/10-display.js +3 -0
  60. package/dist/lib/reference/rgaa/rules/11-form.d.ts +14 -0
  61. package/dist/lib/reference/rgaa/rules/11-form.js +16 -0
  62. package/dist/lib/reference/rgaa/rules/12-navigation.d.ts +2 -0
  63. package/dist/lib/reference/rgaa/rules/12-navigation.js +3 -0
  64. package/dist/lib/reference/rgaa/rules/13-visit.d.ts +2 -0
  65. package/dist/lib/reference/rgaa/rules/13-visit.js +3 -0
  66. package/dist/lib/reference/rgaa/rules/2-frame.d.ts +14 -0
  67. package/dist/lib/reference/rgaa/rules/2-frame.js +34 -0
  68. package/dist/lib/reference/rgaa/rules/3-color.d.ts +14 -0
  69. package/dist/lib/reference/rgaa/rules/3-color.js +50 -0
  70. package/dist/lib/reference/rgaa/rules/4-multimedia.d.ts +2 -0
  71. package/dist/lib/reference/rgaa/rules/4-multimedia.js +3 -0
  72. package/dist/lib/reference/rgaa/rules/5-table.d.ts +2 -0
  73. package/dist/lib/reference/rgaa/rules/5-table.js +3 -0
  74. package/dist/lib/reference/rgaa/rules/6-link.d.ts +2 -0
  75. package/dist/lib/reference/rgaa/rules/6-link.js +3 -0
  76. package/dist/lib/reference/rgaa/rules/7-script.d.ts +2 -0
  77. package/dist/lib/reference/rgaa/rules/7-script.js +3 -0
  78. package/dist/lib/reference/rgaa/rules/8-required-element.d.ts +14 -0
  79. package/dist/lib/reference/rgaa/rules/8-required-element.js +78 -0
  80. package/dist/lib/reference/rgaa/rules/9-structure.d.ts +2 -0
  81. package/dist/lib/reference/rgaa/rules/9-structure.js +3 -0
  82. package/dist/lib/reference/rgaa/selector-helper.d.ts +17 -0
  83. package/dist/lib/reference/rgaa/selector-helper.js +33 -0
  84. package/dist/package.json +63 -0
  85. package/package.json +63 -0
package/LICENSE ADDED
@@ -0,0 +1,24 @@
1
+
2
+
3
+ MIT License
4
+
5
+ Copyright (c) 2023 Orange
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
8
+ this software and associated documentation files (the "Software"), to deal in
9
+ the Software without restriction, including without limitation the rights to use,
10
+ copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
11
+ Software, and to permit persons to whom the Software is furnished to do so,
12
+ subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24
+ OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,199 @@
1
+
2
+ # @uuv/a11y
3
+ <div align="center">
4
+ <a href="https://orange-opensource.github.io/uuv/">
5
+ <picture>
6
+ <img alt="UUV Logo" src="https://orange-opensource.github.io/uuv/img/uuv.png">
7
+ </picture>
8
+ </a>
9
+ </div>
10
+
11
+ <h3 align="center">
12
+ Automated a11y validation
13
+ </h3>
14
+
15
+ <p align="center">
16
+ @uuv/a11y is a solution for automated accessibility validations
17
+ </p>
18
+
19
+ <p align="center">
20
+ <a href="https://www.npmjs.com/package/@uuv/commons" target="_blank">
21
+ <img src="https://img.shields.io/badge/available%20on%20npm-grey?logo=npm" alt="npm"/>
22
+ </a>
23
+ <a href="https://www.npmjs.com/package/@uuv/commons" target="_blank">
24
+ <img src="https://img.shields.io/badge/accessibility-yes-green" alt="accessibility"/>
25
+ </a>
26
+ <a href="https://jestjs.io/fr/" target="_blank">
27
+ <img src="https://img.shields.io/badge/tested%20with-jest-yellow?logo=jest" alt="jest"/>
28
+ </a>
29
+ <br />
30
+ </p>
31
+
32
+ <div align="center">
33
+ <a href="https://www.npmjs.com/package/@uuv/cypress" target="_blank">
34
+ <img alt="@uuv/cypress npm library download count"
35
+ src="https://img.shields.io/npm/dt/%40uuv/cypress?logo=npm&label=%40uuv%2Fcypress"></img>
36
+ </a>
37
+ <a href="https://www.npmjs.com/package/@uuv/playwright" target="_blank">
38
+ <img alt="@uuv/playwright npm library download count"
39
+ src="https://img.shields.io/npm/dt/%40uuv/playwright?logo=npm&label=%40uuv%2Fplaywright"></img>
40
+ </a>
41
+ <a href="https://www.npmjs.com/package/@uuv/assistant" target="_blank">
42
+ <img alt="@uuv/assistant npm library download count"
43
+ src="https://img.shields.io/npm/dt/%40uuv/assistant?logo=npm&label=%40uuv%2Fassistant"></img>
44
+ </a>
45
+ <a href="https://www.npmjs.com/package/@uuv/a11y" target="_blank">
46
+ <img alt="@uuv/a11y npm library download count"
47
+ src="https://img.shields.io/npm/dt/%40uuv/a11y?logo=npm&label=%40uuv%2Fa11y"></img>
48
+ </a>
49
+ <a href="https://plugins.jetbrains.com/plugin/22437-uuv" target="_blank">
50
+ <img alt="JetBrains Plugin Downloads" src="https://img.shields.io/jetbrains/plugin/d/22437-uuv?logo=jetbrains&label=UUV%20plugin"></img>
51
+ </a>
52
+ <br />
53
+ </div>
54
+
55
+ ## What is @uuv/a11y?
56
+
57
+ <p align="center">
58
+
59
+ The `@uuv` library (User centric Usecases Validator) is an accessibility driven solution to facilitate the writing and execution of end-to-end tests that are understandable to any human being.
60
+
61
+ `@uuv/a11y` is the part of this solution used to perform automated accessibility checks to guarantee non-regression.
62
+
63
+
64
+ ## How it works ?
65
+ The following references are available :
66
+
67
+ ### RGAA
68
+
69
+ For each criterion of the RGAA, the following algorithm is executed :
70
+
71
+ ![Diagram a11Y RGAA](./docs/diagram-a11y-rgaa.png)
72
+
73
+ **Consult [this page](https://orange-opensource.github.io/uuv/docs/tools/uuv-a11y#rgaa) to find out which RGAA verifications are implemented in the library**
74
+ </p>
75
+
76
+ ## Usage
77
+ ### With UNPKG
78
+ 1. Add script tag to import @uuv/a11y in your html page :
79
+ ```html
80
+ <script src="https://unpkg.com/@uuv/a11y/dist/bundle/uuv-a11y.bundle.js">
81
+ </script>
82
+ ```
83
+ 2. Add script tag to execute
84
+ ```html
85
+ <script>
86
+ const rgaaChecker = new uuvA11y.RgaaChecker(url, enabledRules);
87
+ const result = await rgaaChecker.validate().toPromise();
88
+ // Print complete result
89
+ console.log(result);
90
+ // Print result summary group by criteria
91
+ console.log(result.summary());
92
+ </script>
93
+ ```
94
+ [Stackblitz example](https://stackblitz.com/edit/web-platform-fihgra?file=index.html)
95
+
96
+ ### As a dependency
97
+ 1. Import @uuv/a11y npm dependency
98
+ ```shell
99
+ npm install -D @uuv/a11y
100
+ ```
101
+ 2. Use it in your file
102
+ ```typescript
103
+ import {
104
+ RgaaChecker,
105
+ A11yResult,
106
+ } from "@uuv/a11y";
107
+
108
+ const currentUrl = "<set your current url>";
109
+ const rgaaChecker = new RgaaChecker(currentUrl, enabledRules);
110
+ const result: A11yResult = await rgaaChecker.validate().toPromise();
111
+ // Print complete result
112
+ console.log(result);
113
+ // Print result summary group by criteria
114
+ console.log(result.summary());
115
+ ```
116
+ ### During E2E Testing (recommended usage car visualisation des noeuds)
117
+ 1. add `@uuv/cypress` npm dependency :
118
+ ```shell
119
+ npm install --save-dev @uuv/cypress
120
+ ```
121
+ 2. create the file `uuv/e2e/a11y.feature` in the project root with the following content and replace url `https://e2e-test-quest.github.io/simple-webapp/a11y-test.html` by yours :
122
+ ```gherkin
123
+ Feature: A11y
124
+
125
+ Scenario: Default RGAA
126
+ When I visit path "https://e2e-test-quest.github.io/simple-webapp/a11y-test.html"
127
+ Then I should not have any rgaa accessibility issue
128
+
129
+ Scenario: RGAA with result
130
+ When I visit path "https://e2e-test-quest.github.io/simple-webapp/a11y-test.html"
131
+ Then I should have the following result based on the rgaa reference
132
+ """json
133
+ {
134
+ "status": "error",
135
+ "criteria": {
136
+ "1.1": {
137
+ "status": "error"
138
+ },
139
+ "1.2": {
140
+ "status": "error"
141
+ },
142
+ "1.3": {
143
+ "status": "manual"
144
+ },
145
+ "1.4": {
146
+ "status": "manual"
147
+ },
148
+ "1.5": {
149
+ "status": "manual"
150
+ },
151
+ "1.6": {
152
+ "status": "success"
153
+ },
154
+ "2.1": {
155
+ "status": "error"
156
+ },
157
+ "8.1": {
158
+ "status": "error"
159
+ },
160
+ "8.3": {
161
+ "status": "success"
162
+ },
163
+ "8.4": {
164
+ "status": "manual"
165
+ },
166
+ "8.5": {
167
+ "status": "error"
168
+ },
169
+ "8.6": {
170
+ "status": "manual"
171
+ },
172
+ "8.10": {
173
+ "status": "error"
174
+ },
175
+ "11.1": {
176
+ "status": "success"
177
+ }
178
+ }
179
+ }
180
+ """
181
+ ```
182
+ 3. Then execute your tests :
183
+ ```shell
184
+ npx uuv e2e
185
+ ```
186
+
187
+
188
+ ## License
189
+
190
+ [<a href="https://github.com/Orange-OpenSource/uuv/blob/main/LICENSE">
191
+ <img src="https://img.shields.io/badge/license-MIT-blue" alt="MIT license"/>
192
+ </a>](https://spdx.org/licenses/MIT.html)
193
+
194
+ This project is licensed under the terms of the [MIT license](https://github.com/Orange-OpenSource/uuv/blob/main/LICENSE).
195
+
196
+ ## Authors
197
+
198
+ - [@luifr10](https://github.com/luifr10)
199
+ - [@stanlee974](https://github.com/stanlee974)