@uuv/a11y 0.0.1 → 1.0.0-beta.10

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 (104) hide show
  1. package/CHANGELOG.md +123 -0
  2. package/CONTRIBUTING.md +46 -0
  3. package/LICENSE +1 -1
  4. package/README.md +49 -69
  5. package/STRUCTURE.md +10 -0
  6. package/bundle/uuv-a11y.bundle.js +2 -2
  7. package/bundle/uuv-a11y.bundle.js.LICENSE.txt +1 -19
  8. package/dist/CHANGELOG.md +116 -0
  9. package/dist/CONTRIBUTING.md +46 -0
  10. package/dist/README.md +49 -69
  11. package/dist/STRUCTURE.md +10 -0
  12. package/dist/index.d.ts +1 -1
  13. package/dist/index.js +17 -17
  14. package/dist/lib/engine/engine.d.ts +12 -12
  15. package/dist/lib/engine/engine.js +135 -123
  16. package/dist/lib/index.d.ts +3 -3
  17. package/dist/lib/index.js +19 -19
  18. package/dist/lib/model/checker.d.ts +14 -14
  19. package/dist/lib/model/checker.js +35 -35
  20. package/dist/lib/model/index.d.ts +4 -4
  21. package/dist/lib/model/index.js +20 -20
  22. package/dist/lib/model/reference.d.ts +55 -55
  23. package/dist/lib/model/reference.js +66 -66
  24. package/dist/lib/model/result.d.ts +58 -57
  25. package/dist/lib/model/result.js +144 -144
  26. package/dist/lib/model/rule.d.ts +92 -99
  27. package/dist/lib/model/rule.js +51 -53
  28. package/dist/lib/query/00-query.d.ts +9 -4
  29. package/dist/lib/query/00-query.js +12 -2
  30. package/dist/lib/query/accessible-name.query.d.ts +8 -8
  31. package/dist/lib/query/accessible-name.query.js +31 -34
  32. package/dist/lib/query/by-role.query.d.ts +9 -8
  33. package/dist/lib/query/by-role.query.js +43 -27
  34. package/dist/lib/query/by-sibling.query.d.ts +12 -0
  35. package/dist/lib/query/by-sibling.query.js +100 -0
  36. package/dist/lib/query/by-tag.query.d.ts +7 -7
  37. package/dist/lib/query/by-tag.query.js +19 -20
  38. package/dist/lib/query/compliant-attributes/attribut-specification.d.ts +25 -0
  39. package/dist/lib/query/compliant-attributes/attribut-specification.js +71 -0
  40. package/dist/lib/query/compliant-attributes/attribute-checker.d.ts +35 -0
  41. package/dist/lib/query/compliant-attributes/attribute-checker.js +55 -0
  42. package/dist/lib/query/compliant-attributes/compliant-attributes.query.d.ts +9 -0
  43. package/dist/lib/query/compliant-attributes/compliant-attributes.query.js +24 -0
  44. package/dist/lib/query/doctype.query.d.ts +5 -5
  45. package/dist/lib/query/doctype.query.js +16 -15
  46. package/dist/lib/query/form.query.d.ts +8 -8
  47. package/dist/lib/query/form.query.js +87 -87
  48. package/dist/lib/query/index.d.ts +13 -6
  49. package/dist/lib/query/index.js +29 -22
  50. package/dist/lib/query/operators/and-query.d.ts +8 -0
  51. package/dist/lib/query/operators/and-query.js +25 -0
  52. package/dist/lib/query/operators/operator-query.d.ts +8 -0
  53. package/dist/lib/query/operators/operator-query.js +14 -0
  54. package/dist/lib/query/operators/or-query.d.ts +8 -0
  55. package/dist/lib/query/operators/or-query.js +24 -0
  56. package/dist/lib/reference/alix/alix-checker.js +82 -82
  57. package/dist/lib/reference/alix/alix-rules.js +1028 -1028
  58. package/dist/lib/reference/alix/index.js +3 -3
  59. package/dist/lib/reference/index.d.ts +1 -1
  60. package/dist/lib/reference/index.js +18 -18
  61. package/dist/lib/reference/rgaa/common.d.ts +2 -2
  62. package/dist/lib/reference/rgaa/common.js +5 -5
  63. package/dist/lib/reference/rgaa/coverage/coverage-helper.d.ts +2 -2
  64. package/dist/lib/reference/rgaa/coverage/coverage-helper.js +100 -100
  65. package/dist/lib/reference/rgaa/coverage/coverage-statement.json +110 -90
  66. package/dist/lib/reference/rgaa/index.d.ts +2 -2
  67. package/dist/lib/reference/rgaa/index.js +18 -18
  68. package/dist/lib/reference/rgaa/rgaa-checker.d.ts +8 -8
  69. package/dist/lib/reference/rgaa/rgaa-checker.js +31 -31
  70. package/dist/lib/reference/rgaa/rgaa-reference.d.ts +2 -2
  71. package/dist/lib/reference/rgaa/rgaa-reference.js +44 -44
  72. package/dist/lib/reference/rgaa/rgaa_4.1.criteres.json +4144 -4144
  73. package/dist/lib/reference/rgaa/rules/1-image.d.ts +13 -14
  74. package/dist/lib/reference/rgaa/rules/1-image.js +618 -644
  75. package/dist/lib/reference/rgaa/rules/10-display.d.ts +2 -2
  76. package/dist/lib/reference/rgaa/rules/10-display.js +3 -3
  77. package/dist/lib/reference/rgaa/rules/11-form.d.ts +13 -14
  78. package/dist/lib/reference/rgaa/rules/11-form.js +15 -16
  79. package/dist/lib/reference/rgaa/rules/12-navigation.d.ts +2 -2
  80. package/dist/lib/reference/rgaa/rules/12-navigation.js +3 -3
  81. package/dist/lib/reference/rgaa/rules/13-visit.d.ts +2 -2
  82. package/dist/lib/reference/rgaa/rules/13-visit.js +3 -3
  83. package/dist/lib/reference/rgaa/rules/2-frame.d.ts +13 -14
  84. package/dist/lib/reference/rgaa/rules/2-frame.js +35 -34
  85. package/dist/lib/reference/rgaa/rules/3-color.d.ts +13 -14
  86. package/dist/lib/reference/rgaa/rules/3-color.js +47 -50
  87. package/dist/lib/reference/rgaa/rules/4-multimedia.d.ts +2 -2
  88. package/dist/lib/reference/rgaa/rules/4-multimedia.js +3 -3
  89. package/dist/lib/reference/rgaa/rules/5-table.d.ts +13 -2
  90. package/dist/lib/reference/rgaa/rules/5-table.js +294 -3
  91. package/dist/lib/reference/rgaa/rules/6-link.d.ts +2 -2
  92. package/dist/lib/reference/rgaa/rules/6-link.js +3 -3
  93. package/dist/lib/reference/rgaa/rules/7-script.d.ts +2 -2
  94. package/dist/lib/reference/rgaa/rules/7-script.js +3 -3
  95. package/dist/lib/reference/rgaa/rules/8-required-element.d.ts +13 -14
  96. package/dist/lib/reference/rgaa/rules/8-required-element.js +72 -78
  97. package/dist/lib/reference/rgaa/rules/9-structure.d.ts +2 -2
  98. package/dist/lib/reference/rgaa/rules/9-structure.js +3 -3
  99. package/dist/lib/reference/rgaa/selector-helper.d.ts +56 -17
  100. package/dist/lib/reference/rgaa/selector-helper.js +105 -33
  101. package/dist/package.json +15 -3
  102. package/docs/diagram-a11y-rgaa.excalidraw +1654 -0
  103. package/docs/diagram-a11y-rgaa.png +0 -0
  104. package/package.json +15 -3
@@ -1,20 +1,19 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ByTagQuery = void 0;
7
- const jquery_1 = __importDefault(require("jquery"));
8
- class ByTagQuery {
9
- selectors;
10
- constructor(selectors) {
11
- this.selectors = selectors;
12
- }
13
- execute() {
14
- return (0, jquery_1.default)(this.selectors.join(",")).toArray();
15
- }
16
- getSelector() {
17
- return `${this.selectors}`;
18
- }
19
- }
20
- exports.ByTagQuery = ByTagQuery;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ByTagQuery = void 0;
4
+ const _00_query_1 = require("./00-query");
5
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
6
+ const $ = require("jquery/dist/jquery.min");
7
+ class ByTagQuery {
8
+ selectors;
9
+ constructor(selectors) {
10
+ this.selectors = selectors;
11
+ }
12
+ execute() {
13
+ return $(this.selectors.join(",")).toArray().map((element) => new _00_query_1.QueryResult(element));
14
+ }
15
+ getSelector() {
16
+ return `${this.selectors}`;
17
+ }
18
+ }
19
+ exports.ByTagQuery = ByTagQuery;
@@ -0,0 +1,25 @@
1
+ export interface IAttributeSpecification {
2
+ isSatisfiedBy(element: HTMLElement, attributeName: string): boolean;
3
+ }
4
+ export declare class EmptyAttributeSpecification implements IAttributeSpecification {
5
+ isSatisfiedBy(element: HTMLElement, attributeName: string): boolean;
6
+ }
7
+ export declare class NotEmptyAttributeSpecification implements IAttributeSpecification {
8
+ isSatisfiedBy(element: HTMLElement, attributeName: string): boolean;
9
+ }
10
+ export declare class EmptyElementWithIdSpecification implements IAttributeSpecification {
11
+ isSatisfiedBy(element: HTMLElement, attributeName: string): boolean;
12
+ }
13
+ export declare class NotUniqueIdAttributeSpecification implements IAttributeSpecification {
14
+ isSatisfiedBy(element: HTMLElement, attributeName: string): boolean;
15
+ }
16
+ export declare class NotEqualsAttributeSpecification implements IAttributeSpecification {
17
+ private expectedValueList;
18
+ constructor(expectedValueList: string[]);
19
+ isSatisfiedBy(element: HTMLElement, attributeName: string): boolean;
20
+ }
21
+ export declare class EqualsAttributeSpecification implements IAttributeSpecification {
22
+ private expectedValueList;
23
+ constructor(expectedValueList: string[]);
24
+ isSatisfiedBy(element: HTMLElement, attributeName: string): boolean;
25
+ }
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.EqualsAttributeSpecification = exports.NotEqualsAttributeSpecification = exports.NotUniqueIdAttributeSpecification = exports.EmptyElementWithIdSpecification = exports.NotEmptyAttributeSpecification = exports.EmptyAttributeSpecification = void 0;
7
+ const lodash_1 = __importDefault(require("lodash"));
8
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
9
+ const $ = require("jquery/dist/jquery.min");
10
+ class EmptyAttributeSpecification {
11
+ isSatisfiedBy(element, attributeName) {
12
+ const attributeValue = element.getAttribute(attributeName);
13
+ return lodash_1.default.isEmpty(attributeValue);
14
+ }
15
+ }
16
+ exports.EmptyAttributeSpecification = EmptyAttributeSpecification;
17
+ class NotEmptyAttributeSpecification {
18
+ isSatisfiedBy(element, attributeName) {
19
+ const attributeValue = element.getAttribute(attributeName);
20
+ return !lodash_1.default.isEmpty(attributeValue);
21
+ }
22
+ }
23
+ exports.NotEmptyAttributeSpecification = NotEmptyAttributeSpecification;
24
+ class EmptyElementWithIdSpecification {
25
+ isSatisfiedBy(element, attributeName) {
26
+ const attributeValue = element.getAttribute(attributeName);
27
+ if (lodash_1.default.isEmpty(attributeValue) || lodash_1.default.isNull(attributeValue)) {
28
+ return true;
29
+ }
30
+ const bindingNodeId = $(`#${attributeValue.replaceAll(".", "\\.")}`).text();
31
+ return lodash_1.default.isEmpty(bindingNodeId);
32
+ }
33
+ }
34
+ exports.EmptyElementWithIdSpecification = EmptyElementWithIdSpecification;
35
+ class NotUniqueIdAttributeSpecification {
36
+ isSatisfiedBy(element, attributeName) {
37
+ if (lodash_1.default.isNull(element.id) || lodash_1.default.isEmpty(element.id)) {
38
+ return true;
39
+ }
40
+ return $(`[id=${element.id}]`).length > 1;
41
+ }
42
+ }
43
+ exports.NotUniqueIdAttributeSpecification = NotUniqueIdAttributeSpecification;
44
+ class NotEqualsAttributeSpecification {
45
+ expectedValueList;
46
+ constructor(expectedValueList) {
47
+ this.expectedValueList = expectedValueList;
48
+ }
49
+ isSatisfiedBy(element, attributeName) {
50
+ const attributeValue = element.getAttribute(attributeName);
51
+ if (lodash_1.default.isNull(attributeValue)) {
52
+ return true;
53
+ }
54
+ return !this.expectedValueList.includes(attributeValue);
55
+ }
56
+ }
57
+ exports.NotEqualsAttributeSpecification = NotEqualsAttributeSpecification;
58
+ class EqualsAttributeSpecification {
59
+ expectedValueList;
60
+ constructor(expectedValueList) {
61
+ this.expectedValueList = expectedValueList;
62
+ }
63
+ isSatisfiedBy(element, attributeName) {
64
+ const attributeValue = element.getAttribute(attributeName);
65
+ if (lodash_1.default.isNull(attributeValue)) {
66
+ return false;
67
+ }
68
+ return this.expectedValueList.includes(attributeValue);
69
+ }
70
+ }
71
+ exports.EqualsAttributeSpecification = EqualsAttributeSpecification;
@@ -0,0 +1,35 @@
1
+ import { IAttributeSpecification } from "./attribut-specification";
2
+ export declare class CompliantSpecification {
3
+ readonly attribute: string;
4
+ specification: IAttributeSpecification;
5
+ constructor(attribute: string, specification: IAttributeSpecification);
6
+ }
7
+ export declare class AttributeChecker {
8
+ /**
9
+ * Check if the value of the attributeName is empty
10
+ * @param attributeName : HTMLElement attributeName
11
+ */
12
+ static emptyAttribute(attributeName: string): CompliantSpecification;
13
+ /**
14
+ * Check if the value of the attributeName is not empty
15
+ * @param attributeName : HTMLElement attributeName
16
+ */
17
+ static notEmptyAttribute(attributeName: string): CompliantSpecification;
18
+ /**
19
+ * Check that the text of the HTMLElement whose id matches the value of the attribute named attributeName another HTMLElement is empty
20
+ * @param attributeName : HTMLElement attribute name
21
+ */
22
+ static emptyHtmlNodeTargetedByTheAttribute(attributeName: string): CompliantSpecification;
23
+ /**
24
+ * Check that id attribute is not unique in current page
25
+ */
26
+ static notUniqueId(): CompliantSpecification;
27
+ /**
28
+ * Check that html element does not have the expected value
29
+ */
30
+ static notEquals(attributeName: string, expectedValueList: string[]): CompliantSpecification;
31
+ /**
32
+ * Check that html element have the expected value
33
+ */
34
+ static equals(attributeName: string, expectedValueList: string[]): CompliantSpecification;
35
+ }
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AttributeChecker = exports.CompliantSpecification = void 0;
4
+ const attribut_specification_1 = require("./attribut-specification");
5
+ class CompliantSpecification {
6
+ attribute;
7
+ specification;
8
+ constructor(attribute, specification) {
9
+ this.attribute = attribute;
10
+ this.specification = specification;
11
+ }
12
+ }
13
+ exports.CompliantSpecification = CompliantSpecification;
14
+ class AttributeChecker {
15
+ /**
16
+ * Check if the value of the attributeName is empty
17
+ * @param attributeName : HTMLElement attributeName
18
+ */
19
+ static emptyAttribute(attributeName) {
20
+ return new CompliantSpecification(attributeName, new attribut_specification_1.EmptyAttributeSpecification());
21
+ }
22
+ /**
23
+ * Check if the value of the attributeName is not empty
24
+ * @param attributeName : HTMLElement attributeName
25
+ */
26
+ static notEmptyAttribute(attributeName) {
27
+ return new CompliantSpecification(attributeName, new attribut_specification_1.NotEmptyAttributeSpecification());
28
+ }
29
+ /**
30
+ * Check that the text of the HTMLElement whose id matches the value of the attribute named attributeName another HTMLElement is empty
31
+ * @param attributeName : HTMLElement attribute name
32
+ */
33
+ static emptyHtmlNodeTargetedByTheAttribute(attributeName) {
34
+ return new CompliantSpecification(attributeName, new attribut_specification_1.EmptyElementWithIdSpecification());
35
+ }
36
+ /**
37
+ * Check that id attribute is not unique in current page
38
+ */
39
+ static notUniqueId() {
40
+ return new CompliantSpecification("id", new attribut_specification_1.NotUniqueIdAttributeSpecification());
41
+ }
42
+ /**
43
+ * Check that html element does not have the expected value
44
+ */
45
+ static notEquals(attributeName, expectedValueList) {
46
+ return new CompliantSpecification(attributeName, new attribut_specification_1.NotEqualsAttributeSpecification(expectedValueList));
47
+ }
48
+ /**
49
+ * Check that html element have the expected value
50
+ */
51
+ static equals(attributeName, expectedValueList) {
52
+ return new CompliantSpecification(attributeName, new attribut_specification_1.EqualsAttributeSpecification(expectedValueList));
53
+ }
54
+ }
55
+ exports.AttributeChecker = AttributeChecker;
@@ -0,0 +1,9 @@
1
+ import { Query, QueryResult } from "../00-query";
2
+ import { CompliantSpecification } from "./attribute-checker";
3
+ export declare class CompliantAttributesQuery implements Query {
4
+ readonly subQuery: Query;
5
+ readonly attributeSpecifications: CompliantSpecification[];
6
+ constructor(subQuery: Query, attributeSpecifications: CompliantSpecification[]);
7
+ execute(): QueryResult[];
8
+ getSelector(): string;
9
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CompliantAttributesQuery = void 0;
4
+ class CompliantAttributesQuery {
5
+ subQuery;
6
+ attributeSpecifications;
7
+ constructor(subQuery, attributeSpecifications) {
8
+ this.subQuery = subQuery;
9
+ this.attributeSpecifications = attributeSpecifications;
10
+ }
11
+ execute() {
12
+ return this.subQuery.execute().filter((element) => {
13
+ let result = true;
14
+ this.attributeSpecifications.forEach(attributeSpecification => {
15
+ result = result && attributeSpecification.specification.isSatisfiedBy(element.domNode, attributeSpecification.attribute);
16
+ });
17
+ return result;
18
+ });
19
+ }
20
+ getSelector() {
21
+ return `CompliantAttributes: ${this.subQuery.getSelector()}`;
22
+ }
23
+ }
24
+ exports.CompliantAttributesQuery = CompliantAttributesQuery;
@@ -1,5 +1,5 @@
1
- import { Query } from "./00-query";
2
- export declare class DoctypeQuery implements Query {
3
- execute(): HTMLElement[];
4
- getSelector(): string;
5
- }
1
+ import { Query, QueryResult } from "./00-query";
2
+ export declare class DoctypeQuery implements Query {
3
+ execute(): QueryResult[];
4
+ getSelector(): string;
5
+ }
@@ -1,15 +1,16 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DoctypeQuery = void 0;
4
- class DoctypeQuery {
5
- execute() {
6
- if (document?.doctype?.name !== "html") {
7
- return [document.documentElement];
8
- }
9
- return [];
10
- }
11
- getSelector() {
12
- return "doctype";
13
- }
14
- }
15
- exports.DoctypeQuery = DoctypeQuery;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DoctypeQuery = void 0;
4
+ const _00_query_1 = require("./00-query");
5
+ class DoctypeQuery {
6
+ execute() {
7
+ if (document?.doctype?.name !== "html") {
8
+ return [new _00_query_1.QueryResult(document.documentElement)];
9
+ }
10
+ return [];
11
+ }
12
+ getSelector() {
13
+ return "doctype";
14
+ }
15
+ }
16
+ exports.DoctypeQuery = DoctypeQuery;
@@ -1,8 +1,8 @@
1
- import { Query } from "./00-query";
2
- export declare class FormQuery implements Query {
3
- LABEL_ATTRIBUTE: string;
4
- FORMFIELD_SELECTORS: string[];
5
- FORMFIELD_LABEL_ATTRIBUTES: string[];
6
- execute(): HTMLElement[];
7
- getSelector(): string;
8
- }
1
+ import { Query, QueryResult } from "./00-query";
2
+ export declare class FormQuery implements Query {
3
+ LABEL_ATTRIBUTE: string;
4
+ FORMFIELD_SELECTORS: string[];
5
+ FORMFIELD_LABEL_ATTRIBUTES: string[];
6
+ execute(): QueryResult[];
7
+ getSelector(): string;
8
+ }
@@ -1,87 +1,87 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FormQuery = void 0;
4
- class FormQuery {
5
- LABEL_ATTRIBUTE = "$LABEL";
6
- FORMFIELD_SELECTORS = [
7
- "input[type=text]",
8
- "input[type=password]",
9
- "input[type=search]",
10
- "input[type=email]",
11
- "input[type=number]",
12
- "input[type=tel]",
13
- "input[type=url]",
14
- "textarea",
15
- "input[type=checkbox]",
16
- "input[type=radio]",
17
- "input[type=date]",
18
- "input[type=range]",
19
- "input[type=color]",
20
- "input[type=time]",
21
- "input[type=month]",
22
- "input[type=week]",
23
- "input[type=datetime]",
24
- "select",
25
- "datalist",
26
- "optgroup",
27
- "option",
28
- "input[type=file]",
29
- "output",
30
- "progress",
31
- "meter",
32
- "progressbar",
33
- "slider",
34
- "spinbutton",
35
- "textbox",
36
- "listbox",
37
- "searchbox",
38
- "combobox",
39
- "checkbox",
40
- "radio",
41
- "switch",
42
- "input[type=submit]",
43
- "input[type=reset]",
44
- "input[type=hidden]",
45
- "input[type=image]",
46
- "input[type=button]",
47
- "button"
48
- ];
49
- FORMFIELD_LABEL_ATTRIBUTES = [
50
- "aria-labelledby",
51
- "aria-label",
52
- "title",
53
- "$LABEL"
54
- ];
55
- execute() {
56
- // const foundElements = $(this.FORMFIELD_SELECTORS.join(","));
57
- // const elements: HTMLElement[] = [];
58
- // let counter = 0;
59
- // while (counter < foundElements.length - 1) {
60
- // const element = foundElements[counter];
61
- // const attributeFound = rule.attributes.filter(value => {
62
- // return element.getAttribute(value);
63
- // });
64
- // if (attributeFound.length === 0) {
65
- // if (rule.attributes.includes(CustomAttribute.LABEL.toString())) {
66
- // if (!element.id) {
67
- // elements.push(element);
68
- // counter++;
69
- // } else {
70
- // const foundLabelElements = jquery(`label[for=${element.id}]`);
71
- // if (foundLabelElements.length === 0) {
72
- // elements.push(element);
73
- // counter++;
74
- // }
75
- // }
76
- // }
77
- // }
78
- // counter++;
79
- // }
80
- //TODO implements filter
81
- return [];
82
- }
83
- getSelector() {
84
- return "FormFilter";
85
- }
86
- }
87
- exports.FormQuery = FormQuery;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FormQuery = void 0;
4
+ class FormQuery {
5
+ LABEL_ATTRIBUTE = "$LABEL";
6
+ FORMFIELD_SELECTORS = [
7
+ "input[type=text]",
8
+ "input[type=password]",
9
+ "input[type=search]",
10
+ "input[type=email]",
11
+ "input[type=number]",
12
+ "input[type=tel]",
13
+ "input[type=url]",
14
+ "textarea",
15
+ "input[type=checkbox]",
16
+ "input[type=radio]",
17
+ "input[type=date]",
18
+ "input[type=range]",
19
+ "input[type=color]",
20
+ "input[type=time]",
21
+ "input[type=month]",
22
+ "input[type=week]",
23
+ "input[type=datetime]",
24
+ "select",
25
+ "datalist",
26
+ "optgroup",
27
+ "option",
28
+ "input[type=file]",
29
+ "output",
30
+ "progress",
31
+ "meter",
32
+ "progressbar",
33
+ "slider",
34
+ "spinbutton",
35
+ "textbox",
36
+ "listbox",
37
+ "searchbox",
38
+ "combobox",
39
+ "checkbox",
40
+ "radio",
41
+ "switch",
42
+ "input[type=submit]",
43
+ "input[type=reset]",
44
+ "input[type=hidden]",
45
+ "input[type=image]",
46
+ "input[type=button]",
47
+ "button"
48
+ ];
49
+ FORMFIELD_LABEL_ATTRIBUTES = [
50
+ "aria-labelledby",
51
+ "aria-label",
52
+ "title",
53
+ "$LABEL"
54
+ ];
55
+ execute() {
56
+ // const foundElements = $(this.FORMFIELD_SELECTORS.join(","));
57
+ // const elements: HTMLElement[] = [];
58
+ // let counter = 0;
59
+ // while (counter < foundElements.length - 1) {
60
+ // const element = foundElements[counter];
61
+ // const attributeFound = rule.attributes.filter(value => {
62
+ // return element.getAttribute(value);
63
+ // });
64
+ // if (attributeFound.length === 0) {
65
+ // if (rule.attributes.includes(CustomAttribute.LABEL.toString())) {
66
+ // if (!element.id) {
67
+ // elements.push(element);
68
+ // counter++;
69
+ // } else {
70
+ // const foundLabelElements = jquery(`label[for=${element.id}]`);
71
+ // if (foundLabelElements.length === 0) {
72
+ // elements.push(element);
73
+ // counter++;
74
+ // }
75
+ // }
76
+ // }
77
+ // }
78
+ // counter++;
79
+ // }
80
+ //TODO implements filter
81
+ return [];
82
+ }
83
+ getSelector() {
84
+ return "FormFilter";
85
+ }
86
+ }
87
+ exports.FormQuery = FormQuery;
@@ -1,6 +1,13 @@
1
- export * from "./00-query";
2
- export * from "./by-tag.query";
3
- export * from "./doctype.query";
4
- export * from "./form.query";
5
- export * from "./by-role.query";
6
- export * from "./accessible-name.query";
1
+ export * from "./00-query";
2
+ export * from "./by-tag.query";
3
+ export * from "./doctype.query";
4
+ export * from "./form.query";
5
+ export * from "./by-role.query";
6
+ export * from "./by-sibling.query";
7
+ export * from "./operators/operator-query";
8
+ export * from "./operators/or-query";
9
+ export * from "./operators/and-query";
10
+ export * from "./accessible-name.query";
11
+ export * from "./compliant-attributes/compliant-attributes.query";
12
+ export * from "./compliant-attributes/attribute-checker";
13
+ export * from "./compliant-attributes/attribut-specification";
@@ -1,22 +1,29 @@
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("./00-query"), exports);
18
- __exportStar(require("./by-tag.query"), exports);
19
- __exportStar(require("./doctype.query"), exports);
20
- __exportStar(require("./form.query"), exports);
21
- __exportStar(require("./by-role.query"), exports);
22
- __exportStar(require("./accessible-name.query"), exports);
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("./00-query"), exports);
18
+ __exportStar(require("./by-tag.query"), exports);
19
+ __exportStar(require("./doctype.query"), exports);
20
+ __exportStar(require("./form.query"), exports);
21
+ __exportStar(require("./by-role.query"), exports);
22
+ __exportStar(require("./by-sibling.query"), exports);
23
+ __exportStar(require("./operators/operator-query"), exports);
24
+ __exportStar(require("./operators/or-query"), exports);
25
+ __exportStar(require("./operators/and-query"), exports);
26
+ __exportStar(require("./accessible-name.query"), exports);
27
+ __exportStar(require("./compliant-attributes/compliant-attributes.query"), exports);
28
+ __exportStar(require("./compliant-attributes/attribute-checker"), exports);
29
+ __exportStar(require("./compliant-attributes/attribut-specification"), exports);
@@ -0,0 +1,8 @@
1
+ import { IOperatorQuery } from "./operator-query";
2
+ import { Query, QueryResult } from "../00-query";
3
+ export declare class AndQuery implements IOperatorQuery, Query {
4
+ readonly queries: Query[];
5
+ constructor(queries: Query[]);
6
+ execute(): QueryResult[];
7
+ getSelector(): string;
8
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.AndQuery = void 0;
7
+ const lodash_1 = __importDefault(require("lodash"));
8
+ const DOM_NODE_ATTRIBUTE = "domNode";
9
+ class AndQuery {
10
+ queries;
11
+ constructor(queries) {
12
+ this.queries = queries;
13
+ }
14
+ execute() {
15
+ const queryResults = this.queries.map(query => query.execute());
16
+ return queryResults.reduce((left, right) => {
17
+ return lodash_1.default.intersectionBy(left, right, DOM_NODE_ATTRIBUTE);
18
+ });
19
+ }
20
+ getSelector() {
21
+ const result = this.queries.map(query => query.execute());
22
+ return `${lodash_1.default.intersection(...result).map(query => query.domNode).join(",")}`;
23
+ }
24
+ }
25
+ exports.AndQuery = AndQuery;
@@ -0,0 +1,8 @@
1
+ import { Query } from "../00-query";
2
+ export interface IOperatorQuery {
3
+ queries: Query[];
4
+ }
5
+ export declare class OperatorQuery {
6
+ static Or: (...queries: Query[]) => Query;
7
+ static And: (...queries: Query[]) => Query;
8
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OperatorQuery = void 0;
4
+ const or_query_1 = require("./or-query");
5
+ const and_query_1 = require("./and-query");
6
+ class OperatorQuery {
7
+ static Or = (...queries) => {
8
+ return new or_query_1.OrQuery(queries);
9
+ };
10
+ static And = (...queries) => {
11
+ return new and_query_1.AndQuery(queries);
12
+ };
13
+ }
14
+ exports.OperatorQuery = OperatorQuery;
@@ -0,0 +1,8 @@
1
+ import { IOperatorQuery } from "./operator-query";
2
+ import { Query, QueryResult } from "../00-query";
3
+ export declare class OrQuery implements IOperatorQuery, Query {
4
+ readonly queries: Query[];
5
+ constructor(queries: Query[]);
6
+ execute(): QueryResult[];
7
+ getSelector(): string;
8
+ }