@uuv/a11y 1.0.0-beta.8 → 1.0.0-beta.80
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/CHANGELOG.md +756 -0
- package/LICENSE +0 -2
- package/README.md +21 -7
- package/bundle/uuv-a11y.bundle.js +2 -2
- package/bundle/uuv-a11y.bundle.js.LICENSE.txt +12 -0
- package/dist/CHANGELOG.md +748 -0
- package/dist/README.md +21 -7
- package/dist/lib/model/checker.d.ts +3 -12
- package/dist/lib/model/checker.js +0 -33
- package/dist/lib/model/checklist-checker.d.ts +15 -0
- package/dist/lib/model/checklist-checker.js +61 -0
- package/dist/lib/model/index.d.ts +1 -0
- package/dist/lib/model/index.js +1 -0
- package/dist/lib/model/reference.js +1 -1
- package/dist/lib/model/result.js +1 -1
- package/dist/lib/model/rule.d.ts +8 -8
- package/dist/lib/model/rule.js +3 -3
- package/dist/lib/model/uuv-a11y-result.d.ts +54 -0
- package/dist/lib/model/uuv-a11y-result.js +17 -0
- package/dist/lib/query/accessible-name.query.d.ts +2 -0
- package/dist/lib/query/accessible-name.query.js +8 -2
- package/dist/lib/query/compliant-attributes/attribut-specification.d.ts +9 -0
- package/dist/lib/query/compliant-attributes/attribut-specification.js +29 -4
- package/dist/lib/query/compliant-attributes/attribute-checker.d.ts +12 -0
- package/dist/lib/query/compliant-attributes/attribute-checker.js +18 -0
- package/dist/lib/reference/index.d.ts +1 -0
- package/dist/lib/reference/index.js +1 -0
- package/dist/lib/reference/rgaa/coverage/coverage-helper.js +18 -9
- package/dist/lib/reference/rgaa/coverage/coverage-statement.json +22 -3
- package/dist/lib/reference/rgaa/rgaa-checker.d.ts +3 -3
- package/dist/lib/reference/rgaa/rgaa-checker.js +2 -2
- package/dist/lib/reference/rgaa/rules/1-image.d.ts +4 -4
- package/dist/lib/reference/rgaa/rules/11-form.d.ts +4 -4
- package/dist/lib/reference/rgaa/rules/2-frame.d.ts +4 -4
- package/dist/lib/reference/rgaa/rules/3-color.d.ts +4 -4
- package/dist/lib/reference/rgaa/rules/5-table.d.ts +4 -4
- package/dist/lib/reference/rgaa/rules/6-link.d.ts +12 -1
- package/dist/lib/reference/rgaa/rules/6-link.js +147 -1
- package/dist/lib/reference/rgaa/rules/8-required-element.d.ts +4 -4
- package/dist/lib/reference/rgaa/rules/8-required-element.js +57 -3
- package/dist/lib/reference/wcag/index.d.ts +1 -0
- package/dist/lib/reference/wcag/index.js +17 -0
- package/dist/lib/reference/wcag/wcag-checker.d.ts +14 -0
- package/dist/lib/reference/wcag/wcag-checker.js +86 -0
- package/dist/lib/reference/wcag/wcag-helper.d.ts +9 -0
- package/dist/lib/reference/wcag/wcag-helper.js +73 -0
- package/dist/package.json +20 -14
- package/package.json +18 -12
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { AutoCheckA11yRule } from "../../../model";
|
|
2
2
|
declare const _default: (AutoCheckA11yRule & {
|
|
3
|
-
attributes?: string[]
|
|
3
|
+
attributes?: string[];
|
|
4
4
|
criterion: string;
|
|
5
5
|
wcag: string;
|
|
6
6
|
id: string;
|
|
7
7
|
elementType: string;
|
|
8
8
|
query: import("../../../query").Query;
|
|
9
|
-
description?: string
|
|
10
|
-
help?: string | string[]
|
|
11
|
-
shouldNotExist?: boolean
|
|
9
|
+
description?: string;
|
|
10
|
+
help?: string | string[];
|
|
11
|
+
shouldNotExist?: boolean;
|
|
12
12
|
})[];
|
|
13
13
|
export default _default;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { AutoCheckA11yRule } from "../../../model";
|
|
2
2
|
declare const _default: (AutoCheckA11yRule & {
|
|
3
|
-
attributes?: string[]
|
|
3
|
+
attributes?: string[];
|
|
4
4
|
criterion: string;
|
|
5
5
|
wcag: string;
|
|
6
6
|
id: string;
|
|
7
7
|
elementType: string;
|
|
8
8
|
query: import("../../../query").Query;
|
|
9
|
-
description?: string
|
|
10
|
-
help?: string | string[]
|
|
11
|
-
shouldNotExist?: boolean
|
|
9
|
+
description?: string;
|
|
10
|
+
help?: string | string[];
|
|
11
|
+
shouldNotExist?: boolean;
|
|
12
12
|
})[];
|
|
13
13
|
export default _default;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { AutoCheckA11yRule } from "../../../model";
|
|
2
2
|
declare const _default: (AutoCheckA11yRule & {
|
|
3
|
-
attributes?: string[]
|
|
3
|
+
attributes?: string[];
|
|
4
4
|
criterion: string;
|
|
5
5
|
wcag: string;
|
|
6
6
|
id: string;
|
|
7
7
|
elementType: string;
|
|
8
8
|
query: import("../../../query").Query;
|
|
9
|
-
description?: string
|
|
10
|
-
help?: string | string[]
|
|
11
|
-
shouldNotExist?: boolean
|
|
9
|
+
description?: string;
|
|
10
|
+
help?: string | string[];
|
|
11
|
+
shouldNotExist?: boolean;
|
|
12
12
|
})[];
|
|
13
13
|
export default _default;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ManualCheckA11yRule } from "../../../model";
|
|
2
2
|
declare const _default: (ManualCheckA11yRule & {
|
|
3
|
-
attributes?: string[]
|
|
3
|
+
attributes?: string[];
|
|
4
4
|
criterion: string;
|
|
5
5
|
wcag: string;
|
|
6
6
|
id: string;
|
|
7
7
|
elementType: string;
|
|
8
8
|
query: import("../../../query").Query;
|
|
9
|
-
description?: string
|
|
10
|
-
help?: string
|
|
11
|
-
shouldNotExist?: boolean
|
|
9
|
+
description?: string;
|
|
10
|
+
help?: string;
|
|
11
|
+
shouldNotExist?: boolean;
|
|
12
12
|
})[];
|
|
13
13
|
export default _default;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { AutoCheckA11yRule } from "../../../model";
|
|
2
2
|
declare const _default: (AutoCheckA11yRule & {
|
|
3
|
-
attributes?: string[]
|
|
3
|
+
attributes?: string[];
|
|
4
4
|
criterion: string;
|
|
5
5
|
wcag: string;
|
|
6
6
|
id: string;
|
|
7
7
|
elementType: string;
|
|
8
8
|
query: import("../../../query").Query;
|
|
9
|
-
description?: string
|
|
10
|
-
help?: string | string[]
|
|
11
|
-
shouldNotExist?: boolean
|
|
9
|
+
description?: string;
|
|
10
|
+
help?: string | string[];
|
|
11
|
+
shouldNotExist?: boolean;
|
|
12
12
|
})[];
|
|
13
13
|
export default _default;
|
|
@@ -1,2 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import { AutoCheckA11yRule } from "../../../model";
|
|
2
|
+
declare const _default: (AutoCheckA11yRule & {
|
|
3
|
+
attributes?: string[];
|
|
4
|
+
criterion: string;
|
|
5
|
+
wcag: string;
|
|
6
|
+
id: string;
|
|
7
|
+
elementType: string;
|
|
8
|
+
query: import("../../../query").Query;
|
|
9
|
+
description?: string;
|
|
10
|
+
help?: string | string[];
|
|
11
|
+
shouldNotExist?: boolean;
|
|
12
|
+
})[];
|
|
2
13
|
export default _default;
|
|
@@ -1,3 +1,149 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
const model_1 = require("../../../model");
|
|
4
|
+
const query_1 = require("../../../query");
|
|
5
|
+
const SELECTOR_ALL_LINK = [
|
|
6
|
+
"a",
|
|
7
|
+
"[role=link]"
|
|
8
|
+
];
|
|
9
|
+
const SELECTOR_LINK_TEXT = [
|
|
10
|
+
":not(svg) > a[href]:not(:has(img)):not(:has([role=img])):not(:has(object)):not(:has(canvas)):not(:has(svg))",
|
|
11
|
+
":not(svg) > [role=link]:not(:has(img)):not(:has([role=img])):not(:has(object)):not(:has(canvas)):not(:has(svg))"
|
|
12
|
+
];
|
|
13
|
+
const SELECTOR_LINK_CONTAINING_IMAGE = [
|
|
14
|
+
":not(svg) > a[href]:has(img)",
|
|
15
|
+
":not(svg) > a[href]:has([role=img])",
|
|
16
|
+
":not(svg) > a[href]:has(area[href])",
|
|
17
|
+
":not(svg) > a[href]:has(object)",
|
|
18
|
+
":not(svg) > a[href]:has(canvas)",
|
|
19
|
+
":not(svg) > a[href]:has(svg)",
|
|
20
|
+
":not(svg) > [role=link]:has(img)",
|
|
21
|
+
":not(svg) > [role=link]:has([role=img])",
|
|
22
|
+
":not(svg) > [role=link]:has(area[href])",
|
|
23
|
+
":not(svg) > [role=link]:has(object)",
|
|
24
|
+
":not(svg) > [role=link]:has(canvas)",
|
|
25
|
+
":not(svg) > [role=link]:has(svg)"
|
|
26
|
+
];
|
|
27
|
+
const SELECTOR_LINK_SVG = [
|
|
28
|
+
"svg:has(a[href])",
|
|
29
|
+
"svg:has(a[xlink-href])"
|
|
30
|
+
];
|
|
31
|
+
const IMAGE_LINK_QUERY = new query_1.CompliantAttributesQuery(new query_1.ByTagQuery([
|
|
32
|
+
...SELECTOR_LINK_CONTAINING_IMAGE
|
|
33
|
+
]), [
|
|
34
|
+
query_1.AttributeChecker.emptyText()
|
|
35
|
+
]);
|
|
36
|
+
const COMPOSITE_LINK_QUERY = new query_1.CompliantAttributesQuery(new query_1.ByTagQuery([
|
|
37
|
+
...SELECTOR_LINK_CONTAINING_IMAGE
|
|
38
|
+
]), [
|
|
39
|
+
query_1.AttributeChecker.notEmptyText()
|
|
40
|
+
]);
|
|
41
|
+
exports.default = [
|
|
42
|
+
model_1.AutoCheckA11yRule.from({
|
|
43
|
+
criterion: "6.1",
|
|
44
|
+
wcag: "1.1.1 A, 2.4.4 A, 2.5.3 A",
|
|
45
|
+
id: "6.1.1",
|
|
46
|
+
elementType: "link",
|
|
47
|
+
query: new query_1.AccessibleNameQuery(new query_1.ByTagQuery([
|
|
48
|
+
...SELECTOR_LINK_TEXT
|
|
49
|
+
]), true),
|
|
50
|
+
description: "text link must be explicit",
|
|
51
|
+
help: "Check link accessible name or link context"
|
|
52
|
+
}),
|
|
53
|
+
model_1.ManualCheckA11yRule.from({
|
|
54
|
+
criterion: "6.1",
|
|
55
|
+
wcag: "1.1.1 A, 2.4.4 A, 2.5.3 A",
|
|
56
|
+
id: "6.1.1",
|
|
57
|
+
elementType: "link",
|
|
58
|
+
query: new query_1.AccessibleNameQuery(new query_1.ByTagQuery([
|
|
59
|
+
...SELECTOR_LINK_TEXT
|
|
60
|
+
]), false),
|
|
61
|
+
description: "text link must be explicit",
|
|
62
|
+
help: "Check link accessible name or link context"
|
|
63
|
+
}),
|
|
64
|
+
model_1.AutoCheckA11yRule.from({
|
|
65
|
+
criterion: "6.1",
|
|
66
|
+
wcag: "1.1.1 A, 2.4.4 A, 2.5.3 A",
|
|
67
|
+
id: "6.1.2",
|
|
68
|
+
elementType: "link",
|
|
69
|
+
query: new query_1.AccessibleNameQuery(IMAGE_LINK_QUERY, true),
|
|
70
|
+
description: "image link must be explicit",
|
|
71
|
+
help: "Check link accessible name or link context"
|
|
72
|
+
}),
|
|
73
|
+
model_1.ManualCheckA11yRule.from({
|
|
74
|
+
criterion: "6.1",
|
|
75
|
+
wcag: "1.1.1 A, 2.4.4 A, 2.5.3 A",
|
|
76
|
+
id: "6.1.2",
|
|
77
|
+
elementType: "link",
|
|
78
|
+
query: new query_1.AccessibleNameQuery(IMAGE_LINK_QUERY, false),
|
|
79
|
+
description: "image link must be explicit",
|
|
80
|
+
help: "Check link accessible name or link context"
|
|
81
|
+
}),
|
|
82
|
+
model_1.ManualCheckA11yRule.from({
|
|
83
|
+
criterion: "6.1",
|
|
84
|
+
wcag: "1.1.1 A, 2.4.4 A, 2.5.3 A",
|
|
85
|
+
id: "6.1.3",
|
|
86
|
+
elementType: "link",
|
|
87
|
+
query: new query_1.AccessibleNameQuery(COMPOSITE_LINK_QUERY, false),
|
|
88
|
+
description: "image link must be explicit",
|
|
89
|
+
help: "Check link accessible name or link context"
|
|
90
|
+
}),
|
|
91
|
+
model_1.AutoCheckA11yRule.from({
|
|
92
|
+
criterion: "6.1",
|
|
93
|
+
wcag: "1.1.1 A, 2.4.4 A, 2.5.3 A",
|
|
94
|
+
id: "6.1.4",
|
|
95
|
+
elementType: "link",
|
|
96
|
+
query: new query_1.AccessibleNameQuery(new query_1.ByTagQuery([
|
|
97
|
+
...SELECTOR_LINK_SVG
|
|
98
|
+
]), true),
|
|
99
|
+
description: "svg link must be explicit",
|
|
100
|
+
help: "Check link accessible name or link context"
|
|
101
|
+
}),
|
|
102
|
+
model_1.ManualCheckA11yRule.from({
|
|
103
|
+
criterion: "6.1",
|
|
104
|
+
wcag: "1.1.1 A, 2.4.4 A, 2.5.3 A",
|
|
105
|
+
id: "6.1.4",
|
|
106
|
+
elementType: "link",
|
|
107
|
+
query: new query_1.AccessibleNameQuery(new query_1.ByTagQuery([
|
|
108
|
+
...SELECTOR_LINK_SVG
|
|
109
|
+
]), false),
|
|
110
|
+
description: "svg link must be explicit",
|
|
111
|
+
help: "Check link accessible name or link context"
|
|
112
|
+
}),
|
|
113
|
+
model_1.AutoCheckA11yRule.from({
|
|
114
|
+
criterion: "6.1",
|
|
115
|
+
wcag: "1.1.1 A, 2.4.4 A, 2.5.3 A",
|
|
116
|
+
id: "6.1.5",
|
|
117
|
+
elementType: "link",
|
|
118
|
+
query: new query_1.CompliantAttributesQuery(new query_1.ByTagQuery([
|
|
119
|
+
...SELECTOR_LINK_TEXT,
|
|
120
|
+
...SELECTOR_LINK_CONTAINING_IMAGE
|
|
121
|
+
]), [
|
|
122
|
+
query_1.AttributeChecker.accessibleNameNotContainsVisibleText()
|
|
123
|
+
]),
|
|
124
|
+
description: "Accessible name must contains visible text for text link and image link",
|
|
125
|
+
help: "Accessible name must contains visible text for text link and image link"
|
|
126
|
+
}),
|
|
127
|
+
model_1.ManualCheckA11yRule.from({
|
|
128
|
+
criterion: "6.1",
|
|
129
|
+
wcag: "1.1.1 A, 2.4.4 A, 2.5.3 A",
|
|
130
|
+
id: "6.1.5",
|
|
131
|
+
elementType: "link",
|
|
132
|
+
query: new query_1.ByTagQuery([
|
|
133
|
+
...SELECTOR_LINK_SVG
|
|
134
|
+
]),
|
|
135
|
+
description: "Accessible name must contains visible text for svg link",
|
|
136
|
+
help: "Accessible name must contains visible text for svg link"
|
|
137
|
+
}),
|
|
138
|
+
model_1.AutoCheckA11yRule.from({
|
|
139
|
+
criterion: "6.2",
|
|
140
|
+
wcag: "1.1.1 A, 2.4.4 A",
|
|
141
|
+
id: "6.2.1",
|
|
142
|
+
elementType: "link",
|
|
143
|
+
query: new query_1.AccessibleNameQuery(new query_1.ByTagQuery([
|
|
144
|
+
...SELECTOR_ALL_LINK
|
|
145
|
+
]), true),
|
|
146
|
+
description: "Every link must have an accessible name",
|
|
147
|
+
help: "Every link must have an accessible name"
|
|
148
|
+
})
|
|
149
|
+
];
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { AutoCheckA11yRule } from "../../../model";
|
|
2
2
|
declare const _default: (AutoCheckA11yRule & {
|
|
3
|
-
attributes?: string[]
|
|
3
|
+
attributes?: string[];
|
|
4
4
|
criterion: string;
|
|
5
5
|
wcag: string;
|
|
6
6
|
id: string;
|
|
7
7
|
elementType: string;
|
|
8
8
|
query: import("../../../query").Query;
|
|
9
|
-
description?: string
|
|
10
|
-
help?: string | string[]
|
|
11
|
-
shouldNotExist?: boolean
|
|
9
|
+
description?: string;
|
|
10
|
+
help?: string | string[];
|
|
11
|
+
shouldNotExist?: boolean;
|
|
12
12
|
})[];
|
|
13
13
|
export default _default;
|
|
@@ -10,7 +10,25 @@ exports.default = [
|
|
|
10
10
|
elementType: "doctype",
|
|
11
11
|
query: new query_1.DoctypeQuery(),
|
|
12
12
|
description: "current page has no doctype or a doctype different to html",
|
|
13
|
-
help: "add <!DOCTYPE html> in the current page"
|
|
13
|
+
help: "add <!DOCTYPE html> before html tag in the current page"
|
|
14
|
+
}),
|
|
15
|
+
model_1.AutoCheckA11yRule.from({
|
|
16
|
+
criterion: "8.1",
|
|
17
|
+
wcag: "4.1.1 A",
|
|
18
|
+
id: "8.1.2",
|
|
19
|
+
elementType: "doctype",
|
|
20
|
+
query: new query_1.DoctypeQuery(),
|
|
21
|
+
description: "current page has no doctype or a doctype different to html",
|
|
22
|
+
help: "add <!DOCTYPE html> before html tag in the current page"
|
|
23
|
+
}),
|
|
24
|
+
model_1.AutoCheckA11yRule.from({
|
|
25
|
+
criterion: "8.1",
|
|
26
|
+
wcag: "4.1.1 A",
|
|
27
|
+
id: "8.1.3",
|
|
28
|
+
elementType: "doctype",
|
|
29
|
+
query: new query_1.DoctypeQuery(),
|
|
30
|
+
description: "current page has no doctype or a doctype different to html",
|
|
31
|
+
help: "add <!DOCTYPE html> before html tag in the current page"
|
|
14
32
|
}),
|
|
15
33
|
model_1.AutoCheckA11yRule.from({
|
|
16
34
|
criterion: "8.3",
|
|
@@ -41,7 +59,7 @@ exports.default = [
|
|
|
41
59
|
id: "8.5.1",
|
|
42
60
|
elementType: "title",
|
|
43
61
|
query: new query_1.ByTagQuery([
|
|
44
|
-
"title"
|
|
62
|
+
"html:not(:has(title))"
|
|
45
63
|
]),
|
|
46
64
|
description: "current page has no title tag",
|
|
47
65
|
help: "add a title tag to the current page"
|
|
@@ -58,6 +76,31 @@ exports.default = [
|
|
|
58
76
|
description: "if present, title tag must be relevant",
|
|
59
77
|
help: "adapt this tag content"
|
|
60
78
|
}),
|
|
79
|
+
model_1.ManualCheckA11yRule.from({
|
|
80
|
+
criterion: "8.7",
|
|
81
|
+
wcag: "3.1.2 AA",
|
|
82
|
+
id: "8.7.1",
|
|
83
|
+
elementType: "lang",
|
|
84
|
+
query: new query_1.ByTagQuery([
|
|
85
|
+
"html"
|
|
86
|
+
]),
|
|
87
|
+
attributes: [],
|
|
88
|
+
description: "if present, language switch must be specified",
|
|
89
|
+
help: "wrap concerned text with lang or xml:lang attribute"
|
|
90
|
+
}),
|
|
91
|
+
model_1.ManualCheckA11yRule.from({
|
|
92
|
+
criterion: "8.8",
|
|
93
|
+
wcag: "3.1.2 AA",
|
|
94
|
+
id: "8.8.1",
|
|
95
|
+
elementType: "lang",
|
|
96
|
+
query: new query_1.ByTagQuery([
|
|
97
|
+
":not(html)[lang]",
|
|
98
|
+
":not(html)[xml\\:lang]"
|
|
99
|
+
]),
|
|
100
|
+
attributes: [],
|
|
101
|
+
description: "if present, language switch must be revelant",
|
|
102
|
+
help: "check concerned lang or xml:lang attribute"
|
|
103
|
+
}),
|
|
61
104
|
model_1.AutoCheckA11yRule.from({
|
|
62
105
|
criterion: "8.10",
|
|
63
106
|
wcag: "1.3.2 A",
|
|
@@ -66,7 +109,18 @@ exports.default = [
|
|
|
66
109
|
query: new query_1.ByTagQuery([
|
|
67
110
|
"[dir]:not([dir='rtl'], [dir='ltr'], [dir='auto'])"
|
|
68
111
|
]),
|
|
69
|
-
description: "if present, dir attribute must be
|
|
112
|
+
description: "if present, dir attribute must be compliant",
|
|
113
|
+
help: "adapt value of dir attribute"
|
|
114
|
+
}),
|
|
115
|
+
model_1.ManualCheckA11yRule.from({
|
|
116
|
+
criterion: "8.10",
|
|
117
|
+
wcag: "1.3.2 A",
|
|
118
|
+
id: "8.10.2",
|
|
119
|
+
elementType: "mandatory - reading",
|
|
120
|
+
query: new query_1.ByTagQuery([
|
|
121
|
+
"[dir='rtl'], [dir='ltr']"
|
|
122
|
+
]),
|
|
123
|
+
description: "if present, dir attribute must be compliant",
|
|
70
124
|
help: "adapt value of dir attribute"
|
|
71
125
|
})
|
|
72
126
|
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./wcag-checker";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./wcag-checker"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
import { A11yChecker, A11yResultStatus } from "../../model";
|
|
3
|
+
import { AccessibilityIssue, UuvA11yResultUsecase, UuvA11yResultUsecaseLocation } from "../../model/uuv-a11y-result";
|
|
4
|
+
import axe from "axe-core";
|
|
5
|
+
export type WcagCheckerOptions = axe.RunOptions & {
|
|
6
|
+
includedImpacts?: string[];
|
|
7
|
+
};
|
|
8
|
+
export declare class WcagChecker implements A11yChecker {
|
|
9
|
+
readonly url: string;
|
|
10
|
+
readonly options?: WcagCheckerOptions | undefined;
|
|
11
|
+
protected constructor(url: string, options?: WcagCheckerOptions | undefined);
|
|
12
|
+
validate(name: string, script: string, location: UuvA11yResultUsecaseLocation): Observable<UuvA11yResultUsecase>;
|
|
13
|
+
computeStatus(issues: AccessibilityIssue[]): A11yResultStatus;
|
|
14
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.WcagChecker = void 0;
|
|
40
|
+
const rxjs_1 = require("rxjs");
|
|
41
|
+
const model_1 = require("../../model");
|
|
42
|
+
const uuv_a11y_result_1 = require("../../model/uuv-a11y-result");
|
|
43
|
+
const axe_core_1 = __importDefault(require("axe-core"));
|
|
44
|
+
const WcagHelper = __importStar(require("./wcag-helper"));
|
|
45
|
+
class WcagChecker {
|
|
46
|
+
url;
|
|
47
|
+
options;
|
|
48
|
+
constructor(url, options) {
|
|
49
|
+
this.url = url;
|
|
50
|
+
this.options = options;
|
|
51
|
+
}
|
|
52
|
+
validate(name, script, location) {
|
|
53
|
+
return (0, rxjs_1.from)(axe_core_1.default.run({
|
|
54
|
+
...this.options
|
|
55
|
+
}))
|
|
56
|
+
.pipe((0, rxjs_1.map)(axeResult => {
|
|
57
|
+
const violations = this.options?.includedImpacts ?
|
|
58
|
+
axeResult.violations.filter(issue => issue?.impact && this.options?.includedImpacts?.includes(issue.impact)) :
|
|
59
|
+
axeResult.violations;
|
|
60
|
+
let issues = [];
|
|
61
|
+
[
|
|
62
|
+
...violations
|
|
63
|
+
].forEach(violation => {
|
|
64
|
+
issues = issues.concat(WcagHelper.fromAxeToUvvA11yIssue(violation));
|
|
65
|
+
});
|
|
66
|
+
return {
|
|
67
|
+
name,
|
|
68
|
+
script,
|
|
69
|
+
location,
|
|
70
|
+
result: {
|
|
71
|
+
date: (new Date()).getTime(),
|
|
72
|
+
reference: model_1.A11yReferenceEnum.WCAG_WEB,
|
|
73
|
+
issues,
|
|
74
|
+
status: this.computeStatus(issues)
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
computeStatus(issues) {
|
|
80
|
+
if (issues.find(issue => issue.type === uuv_a11y_result_1.IssueType.Error)) {
|
|
81
|
+
return model_1.A11yResultStatus.ERROR;
|
|
82
|
+
}
|
|
83
|
+
return model_1.A11yResultStatus.SUCCESS;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.WcagChecker = WcagChecker;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import axe from "axe-core";
|
|
2
|
+
import { AccessibilityIssue } from "../../model/uuv-a11y-result";
|
|
3
|
+
/**
|
|
4
|
+
* Process an aXe issue.
|
|
5
|
+
* @private
|
|
6
|
+
* @param {Object} axeIssue - An aXe issue to process.
|
|
7
|
+
* @returns {Object[]} Returns an array of processed issues.
|
|
8
|
+
*/
|
|
9
|
+
export declare function fromAxeToUvvA11yIssue(axeIssue: axe.Result): AccessibilityIssue[];
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fromAxeToUvvA11yIssue = fromAxeToUvvA11yIssue;
|
|
4
|
+
const uuv_a11y_result_1 = require("../../model/uuv-a11y-result");
|
|
5
|
+
/**
|
|
6
|
+
* Convert an aXe selector array to a selector string. Copied from
|
|
7
|
+
* https://github.com/dequelabs/axe-cli/blob/develop/lib/utils.js
|
|
8
|
+
* for now, wonder if we can share or move out.
|
|
9
|
+
* @private
|
|
10
|
+
* @param {Array} selectors - The selector parts.
|
|
11
|
+
* @returns {String} Returns the selector string.
|
|
12
|
+
*/
|
|
13
|
+
function selectorToString(selectors) {
|
|
14
|
+
return selectors
|
|
15
|
+
.reduce((selectorParts, selector) => selectorParts.concat(selector), [])
|
|
16
|
+
.join(" ");
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Convert a axe violation impact to a pa11y level
|
|
20
|
+
* @private
|
|
21
|
+
* @param {string} impact axe level
|
|
22
|
+
* @returns {string} pa11y level
|
|
23
|
+
*/
|
|
24
|
+
function axeImpactToPa11yLevel(impact) {
|
|
25
|
+
switch (impact) {
|
|
26
|
+
case "moderate":
|
|
27
|
+
return uuv_a11y_result_1.IssueType.Warning;
|
|
28
|
+
case "minor":
|
|
29
|
+
return uuv_a11y_result_1.IssueType.Notice;
|
|
30
|
+
case "critical":
|
|
31
|
+
case "serious":
|
|
32
|
+
default:
|
|
33
|
+
return uuv_a11y_result_1.IssueType.Error;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function axeImpactToPa11yImpact(impact) {
|
|
37
|
+
switch (impact) {
|
|
38
|
+
case "critical":
|
|
39
|
+
return uuv_a11y_result_1.IssueImpact.Critical;
|
|
40
|
+
case "serious":
|
|
41
|
+
return uuv_a11y_result_1.IssueImpact.Serious;
|
|
42
|
+
case "moderate":
|
|
43
|
+
return uuv_a11y_result_1.IssueImpact.Moderate;
|
|
44
|
+
case "minor":
|
|
45
|
+
return uuv_a11y_result_1.IssueImpact.Minor;
|
|
46
|
+
default:
|
|
47
|
+
return uuv_a11y_result_1.IssueImpact.Unknown;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Process an aXe issue.
|
|
52
|
+
* @private
|
|
53
|
+
* @param {Object} axeIssue - An aXe issue to process.
|
|
54
|
+
* @returns {Object[]} Returns an array of processed issues.
|
|
55
|
+
*/
|
|
56
|
+
function fromAxeToUvvA11yIssue(axeIssue) {
|
|
57
|
+
// See https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#results-object for a description
|
|
58
|
+
// of an axe issue
|
|
59
|
+
const selectors = axeIssue.nodes.map(node => selectorToString(node.target));
|
|
60
|
+
return selectors.map(selector => ({
|
|
61
|
+
type: axeImpactToPa11yLevel(axeIssue.impact),
|
|
62
|
+
code: axeIssue.id,
|
|
63
|
+
message: `${axeIssue.help} (${axeIssue.helpUrl})`,
|
|
64
|
+
selector,
|
|
65
|
+
htmlElement: window.document.querySelector(selector),
|
|
66
|
+
runnerExtras: {
|
|
67
|
+
description: axeIssue.description,
|
|
68
|
+
impact: axeImpactToPa11yImpact(axeIssue.impact),
|
|
69
|
+
help: axeIssue.help,
|
|
70
|
+
helpUrl: axeIssue.helpUrl
|
|
71
|
+
}
|
|
72
|
+
}));
|
|
73
|
+
}
|
package/dist/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uuv/a11y",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.79",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"author": "Louis Fredice NJAKO MOLOM (https://github.com/luifr10) & Stanley SERVICAL (https://github.com/stanlee974)",
|
|
6
6
|
"description": "A javascript lib for running a11y validation based on multiple reference(RGAA, etc)",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "https://github.com/
|
|
10
|
+
"url": "https://github.com/e2e-test-quest/uuv"
|
|
11
11
|
},
|
|
12
|
-
"homepage": "https://
|
|
12
|
+
"homepage": "https://e2e-test-quest.github.io/uuv/",
|
|
13
13
|
"keywords": [
|
|
14
14
|
"a11y",
|
|
15
15
|
"rgaa",
|
|
@@ -32,31 +32,33 @@
|
|
|
32
32
|
],
|
|
33
33
|
"scripts": {
|
|
34
34
|
"package": "npm pack --pack-destination=\"../../dist/packages\"",
|
|
35
|
-
"test": "
|
|
36
|
-
"test:run": "jest --coverage",
|
|
35
|
+
"test": "npm run e2e-test:run --",
|
|
36
|
+
"e2e-test:run": "jest --coverage",
|
|
37
37
|
"dev": "ts-node watch.ts"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@testing-library/dom": "^
|
|
41
|
-
"
|
|
40
|
+
"@testing-library/dom": "^10.0.0",
|
|
41
|
+
"axe-core": "^4.10.0",
|
|
42
|
+
"dom-accessibility-api": "^0.7.0",
|
|
42
43
|
"emulate-tab": "^1.2.1",
|
|
43
44
|
"jquery": "^3.7.1",
|
|
44
45
|
"lodash": "^4.17.21",
|
|
45
46
|
"rxjs": "^7.8.1"
|
|
46
47
|
},
|
|
47
48
|
"types": "./dist/index.d.ts",
|
|
48
|
-
"main": "./
|
|
49
|
+
"main": "./dist/index.js",
|
|
49
50
|
"devDependencies": {
|
|
50
51
|
"@babel/preset-typescript": "^7.23.3",
|
|
51
52
|
"babel-loader": "^9.1.3",
|
|
52
53
|
"babel-plugin-lodash": "^3.3.4",
|
|
53
|
-
"chokidar": "^
|
|
54
|
-
"jest-
|
|
55
|
-
"puppeteer": "
|
|
54
|
+
"chokidar": "^4.0.0",
|
|
55
|
+
"jest-junit": "^16.0.0",
|
|
56
|
+
"jest-puppeteer": "11.0.0",
|
|
57
|
+
"puppeteer": "23.11.1",
|
|
56
58
|
"tslib": "^2.3.0",
|
|
57
|
-
"webpack": "^5.
|
|
59
|
+
"webpack": "^5.94.0",
|
|
58
60
|
"webpack-cli": "^5.1.4",
|
|
59
|
-
"webpack-dev-server": "^
|
|
61
|
+
"webpack-dev-server": "^5.0.0"
|
|
60
62
|
},
|
|
61
63
|
"files": [
|
|
62
64
|
"dist/**/*",
|
|
@@ -71,5 +73,9 @@
|
|
|
71
73
|
"types": "./dist/index.d.ts"
|
|
72
74
|
},
|
|
73
75
|
"./bundle": "./bundle/uuv-a11y.bundle.js"
|
|
76
|
+
},
|
|
77
|
+
"funding": {
|
|
78
|
+
"type": "opencollective",
|
|
79
|
+
"url": "https://opencollective.com/uuv"
|
|
74
80
|
}
|
|
75
|
-
}
|
|
81
|
+
}
|