@qualweb/best-practices 0.7.0-alpha → 0.7.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/README.md +51 -0
- package/dist/BestPracticesModule.d.ts +10 -0
- package/dist/BestPracticesModule.d.ts.map +1 -0
- package/dist/BestPracticesModule.js +19 -0
- package/dist/BestPracticesRunner.d.ts +9 -0
- package/dist/BestPracticesRunner.d.ts.map +1 -0
- package/dist/BestPracticesRunner.js +17 -0
- package/dist/__webpack/bp.bundle.js +1 -0
- package/dist/best-practices/QW-BP1.d.ts +7 -0
- package/dist/best-practices/QW-BP1.d.ts.map +1 -0
- package/dist/best-practices/QW-BP1.js +37 -0
- package/dist/best-practices/QW-BP10.d.ts +7 -0
- package/dist/best-practices/QW-BP10.d.ts.map +1 -0
- package/dist/best-practices/QW-BP10.js +35 -0
- package/dist/best-practices/QW-BP11.d.ts +7 -0
- package/dist/best-practices/QW-BP11.d.ts.map +1 -0
- package/dist/best-practices/QW-BP11.js +52 -0
- package/dist/best-practices/QW-BP12.d.ts +7 -0
- package/dist/best-practices/QW-BP12.d.ts.map +1 -0
- package/dist/best-practices/QW-BP12.js +65 -0
- package/dist/best-practices/QW-BP13.d.ts +7 -0
- package/dist/best-practices/QW-BP13.d.ts.map +1 -0
- package/dist/best-practices/QW-BP13.js +47 -0
- package/dist/best-practices/QW-BP15.d.ts +8 -0
- package/dist/best-practices/QW-BP15.d.ts.map +1 -0
- package/dist/best-practices/QW-BP15.js +44 -0
- package/dist/best-practices/QW-BP17.d.ts +7 -0
- package/dist/best-practices/QW-BP17.d.ts.map +1 -0
- package/dist/best-practices/QW-BP17.js +26 -0
- package/dist/best-practices/QW-BP18.d.ts +11 -0
- package/dist/best-practices/QW-BP18.d.ts.map +1 -0
- package/dist/best-practices/QW-BP18.js +135 -0
- package/dist/best-practices/QW-BP19.d.ts +7 -0
- package/dist/best-practices/QW-BP19.d.ts.map +1 -0
- package/dist/best-practices/QW-BP19.js +39 -0
- package/dist/best-practices/QW-BP2.d.ts +7 -0
- package/dist/best-practices/QW-BP2.d.ts.map +1 -0
- package/dist/best-practices/QW-BP2.js +51 -0
- package/dist/best-practices/QW-BP20.d.ts +7 -0
- package/dist/best-practices/QW-BP20.d.ts.map +1 -0
- package/dist/best-practices/QW-BP20.js +41 -0
- package/dist/best-practices/QW-BP21.d.ts +7 -0
- package/dist/best-practices/QW-BP21.d.ts.map +1 -0
- package/dist/best-practices/QW-BP21.js +40 -0
- package/dist/best-practices/QW-BP22.d.ts +7 -0
- package/dist/best-practices/QW-BP22.d.ts.map +1 -0
- package/dist/best-practices/QW-BP22.js +40 -0
- package/dist/best-practices/QW-BP23.d.ts +7 -0
- package/dist/best-practices/QW-BP23.d.ts.map +1 -0
- package/dist/best-practices/QW-BP23.js +44 -0
- package/dist/best-practices/QW-BP24.d.ts +7 -0
- package/dist/best-practices/QW-BP24.d.ts.map +1 -0
- package/dist/best-practices/QW-BP24.js +47 -0
- package/dist/best-practices/QW-BP25.d.ts +7 -0
- package/dist/best-practices/QW-BP25.d.ts.map +1 -0
- package/dist/best-practices/QW-BP25.js +38 -0
- package/dist/best-practices/QW-BP26.d.ts +7 -0
- package/dist/best-practices/QW-BP26.d.ts.map +1 -0
- package/dist/best-practices/QW-BP26.js +38 -0
- package/dist/best-practices/QW-BP27.d.ts +7 -0
- package/dist/best-practices/QW-BP27.d.ts.map +1 -0
- package/dist/best-practices/QW-BP27.js +38 -0
- package/dist/best-practices/QW-BP28.d.ts +7 -0
- package/dist/best-practices/QW-BP28.d.ts.map +1 -0
- package/dist/best-practices/QW-BP28.js +44 -0
- package/dist/best-practices/QW-BP29.d.ts +7 -0
- package/dist/best-practices/QW-BP29.d.ts.map +1 -0
- package/dist/best-practices/QW-BP29.js +48 -0
- package/dist/best-practices/QW-BP4.d.ts +7 -0
- package/dist/best-practices/QW-BP4.d.ts.map +1 -0
- package/dist/best-practices/QW-BP4.js +35 -0
- package/dist/best-practices/QW-BP5.d.ts +7 -0
- package/dist/best-practices/QW-BP5.d.ts.map +1 -0
- package/dist/best-practices/QW-BP5.js +21 -0
- package/dist/best-practices/QW-BP6.d.ts +7 -0
- package/dist/best-practices/QW-BP6.d.ts.map +1 -0
- package/dist/best-practices/QW-BP6.js +38 -0
- package/dist/best-practices/QW-BP7.d.ts +7 -0
- package/dist/best-practices/QW-BP7.d.ts.map +1 -0
- package/dist/best-practices/QW-BP7.js +39 -0
- package/dist/best-practices/QW-BP8.d.ts +8 -0
- package/dist/best-practices/QW-BP8.d.ts.map +1 -0
- package/dist/best-practices/QW-BP8.js +71 -0
- package/dist/best-practices/QW-BP9.d.ts +7 -0
- package/dist/best-practices/QW-BP9.d.ts.map +1 -0
- package/dist/best-practices/QW-BP9.js +53 -0
- package/dist/best-practices/index.d.ts +27 -0
- package/dist/best-practices/index.d.ts.map +1 -0
- package/dist/best-practices/index.js +42 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/lib/BestPractice.object.d.ts +21 -0
- package/dist/lib/BestPractice.object.d.ts.map +1 -0
- package/dist/lib/BestPractice.object.js +76 -0
- package/dist/lib/BestPracticesTester.object.d.ts +8 -0
- package/dist/lib/BestPracticesTester.object.d.ts.map +1 -0
- package/dist/lib/BestPracticesTester.object.js +67 -0
- package/dist/lib/bestPractices.json +318 -0
- package/dist/lib/mapping.d.ts +24 -0
- package/dist/lib/mapping.d.ts.map +1 -0
- package/dist/lib/mapping.js +24 -0
- package/package.json +37 -28
- package/LICENSE +0 -15
- package/dist/bp.bundle.js +0 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
13
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
14
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
15
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
16
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
17
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.QW_BP2 = void 0;
|
|
22
|
+
const applicability_1 = require("@qualweb/util/applicability");
|
|
23
|
+
const evaluation_1 = require("@qualweb/core/evaluation");
|
|
24
|
+
const BestPractice_object_1 = require("../lib/BestPractice.object");
|
|
25
|
+
class QW_BP2 extends BestPractice_object_1.BestPractice {
|
|
26
|
+
execute(element) {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
const test = new evaluation_1.Test();
|
|
29
|
+
const altValue = element.getElementAttribute('alt');
|
|
30
|
+
if (altValue.trim().length <= 100) {
|
|
31
|
+
test.verdict = evaluation_1.Verdict.PASSED;
|
|
32
|
+
test.resultCode = 'P1';
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
test.verdict = evaluation_1.Verdict.FAILED;
|
|
36
|
+
test.resultCode = 'F1';
|
|
37
|
+
}
|
|
38
|
+
test.addElement(element);
|
|
39
|
+
this.addTestResult(test);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.QW_BP2 = QW_BP2;
|
|
44
|
+
__decorate([
|
|
45
|
+
applicability_1.ElementExists,
|
|
46
|
+
(0, applicability_1.ElementHasAttribute)('alt'),
|
|
47
|
+
(0, applicability_1.ElementHasNonEmptyAttribute)('alt'),
|
|
48
|
+
__metadata("design:type", Function),
|
|
49
|
+
__metadata("design:paramtypes", [Function]),
|
|
50
|
+
__metadata("design:returntype", Promise)
|
|
51
|
+
], QW_BP2.prototype, "execute", null);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QW-BP20.d.ts","sourceRoot":"","sources":["../../src/best-practices/QW-BP20.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,cAAM,OAAQ,SAAQ,YAAY;IAEhC,OAAO,CAAC,OAAO,EAAE,SAAS,GAAG,IAAI;CAmBlC;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.QW_BP20 = void 0;
|
|
13
|
+
const applicability_1 = require("@qualweb/util/applicability");
|
|
14
|
+
const evaluation_1 = require("@qualweb/core/evaluation");
|
|
15
|
+
const BestPractice_object_1 = require("../lib/BestPractice.object");
|
|
16
|
+
class QW_BP20 extends BestPractice_object_1.BestPractice {
|
|
17
|
+
execute(element) {
|
|
18
|
+
const possibleLandmarkList = element.getElements('header:not([role]), [role=banner]');
|
|
19
|
+
const landmarkList = possibleLandmarkList.filter((element) => window.AccessibilityUtils.getElementRole(element) === 'banner');
|
|
20
|
+
if (landmarkList.length > 0) {
|
|
21
|
+
const test = new evaluation_1.Test();
|
|
22
|
+
if (landmarkList.length < 2) {
|
|
23
|
+
test.verdict = evaluation_1.Verdict.PASSED;
|
|
24
|
+
test.resultCode = 'P1';
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
test.verdict = evaluation_1.Verdict.FAILED;
|
|
28
|
+
test.resultCode = 'F1';
|
|
29
|
+
}
|
|
30
|
+
test.addElements(landmarkList);
|
|
31
|
+
super.addTestResult(test);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.QW_BP20 = QW_BP20;
|
|
36
|
+
__decorate([
|
|
37
|
+
applicability_1.ElementExists,
|
|
38
|
+
__metadata("design:type", Function),
|
|
39
|
+
__metadata("design:paramtypes", [Function]),
|
|
40
|
+
__metadata("design:returntype", void 0)
|
|
41
|
+
], QW_BP20.prototype, "execute", null);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QW-BP21.d.ts","sourceRoot":"","sources":["../../src/best-practices/QW-BP21.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,cAAM,OAAQ,SAAQ,YAAY;IAEhC,OAAO,CAAC,OAAO,EAAE,SAAS,GAAG,IAAI;CAgBlC;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.QW_BP21 = void 0;
|
|
13
|
+
const applicability_1 = require("@qualweb/util/applicability");
|
|
14
|
+
const evaluation_1 = require("@qualweb/core/evaluation");
|
|
15
|
+
const BestPractice_object_1 = require("../lib/BestPractice.object");
|
|
16
|
+
class QW_BP21 extends BestPractice_object_1.BestPractice {
|
|
17
|
+
execute(element) {
|
|
18
|
+
const landmarkList = element.getElements('footer:not([role]), [role=contentinfo]');
|
|
19
|
+
if (landmarkList.length > 0) {
|
|
20
|
+
const test = new evaluation_1.Test();
|
|
21
|
+
if (landmarkList.length < 2) {
|
|
22
|
+
test.verdict = evaluation_1.Verdict.PASSED;
|
|
23
|
+
test.resultCode = 'P1';
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
test.verdict = evaluation_1.Verdict.FAILED;
|
|
27
|
+
test.resultCode = 'F1';
|
|
28
|
+
}
|
|
29
|
+
test.addElements(landmarkList);
|
|
30
|
+
super.addTestResult(test);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.QW_BP21 = QW_BP21;
|
|
35
|
+
__decorate([
|
|
36
|
+
applicability_1.ElementExists,
|
|
37
|
+
__metadata("design:type", Function),
|
|
38
|
+
__metadata("design:paramtypes", [Function]),
|
|
39
|
+
__metadata("design:returntype", void 0)
|
|
40
|
+
], QW_BP21.prototype, "execute", null);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QW-BP22.d.ts","sourceRoot":"","sources":["../../src/best-practices/QW-BP22.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,cAAM,OAAQ,SAAQ,YAAY;IAEhC,OAAO,CAAC,OAAO,EAAE,SAAS,GAAG,IAAI;CAgBlC;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.QW_BP22 = void 0;
|
|
13
|
+
const applicability_1 = require("@qualweb/util/applicability");
|
|
14
|
+
const evaluation_1 = require("@qualweb/core/evaluation");
|
|
15
|
+
const BestPractice_object_1 = require("../lib/BestPractice.object");
|
|
16
|
+
class QW_BP22 extends BestPractice_object_1.BestPractice {
|
|
17
|
+
execute(element) {
|
|
18
|
+
const landmarkList = element.getElements('main:not([role]), [role=main]');
|
|
19
|
+
if (landmarkList.length > 0) {
|
|
20
|
+
const test = new evaluation_1.Test();
|
|
21
|
+
if (landmarkList.length < 2) {
|
|
22
|
+
test.verdict = evaluation_1.Verdict.PASSED;
|
|
23
|
+
test.resultCode = 'P1';
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
test.verdict = evaluation_1.Verdict.FAILED;
|
|
27
|
+
test.resultCode = 'F1';
|
|
28
|
+
}
|
|
29
|
+
test.addElements(landmarkList);
|
|
30
|
+
super.addTestResult(test);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.QW_BP22 = QW_BP22;
|
|
35
|
+
__decorate([
|
|
36
|
+
applicability_1.ElementExists,
|
|
37
|
+
__metadata("design:type", Function),
|
|
38
|
+
__metadata("design:paramtypes", [Function]),
|
|
39
|
+
__metadata("design:returntype", void 0)
|
|
40
|
+
], QW_BP22.prototype, "execute", null);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QW-BP23.d.ts","sourceRoot":"","sources":["../../src/best-practices/QW-BP23.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,cAAM,OAAQ,SAAQ,YAAY;IAGhC,OAAO,CAAC,OAAO,EAAE,SAAS,GAAG,IAAI;CAkBlC;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.QW_BP23 = void 0;
|
|
13
|
+
const applicability_1 = require("@qualweb/util/applicability");
|
|
14
|
+
const evaluation_1 = require("@qualweb/core/evaluation");
|
|
15
|
+
const BestPractice_object_1 = require("../lib/BestPractice.object");
|
|
16
|
+
class QW_BP23 extends BestPractice_object_1.BestPractice {
|
|
17
|
+
execute(element) {
|
|
18
|
+
const test = new evaluation_1.Test();
|
|
19
|
+
const parent = element.getElementParent();
|
|
20
|
+
let isValidParent = false;
|
|
21
|
+
const permittedNames = ['ul', 'ol', 'menu'];
|
|
22
|
+
const parentName = parent === null || parent === void 0 ? void 0 : parent.getElementTagName();
|
|
23
|
+
if (parentName)
|
|
24
|
+
isValidParent = permittedNames.includes(parentName);
|
|
25
|
+
if (isValidParent) {
|
|
26
|
+
test.verdict = evaluation_1.Verdict.PASSED;
|
|
27
|
+
test.resultCode = 'P1';
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
test.verdict = evaluation_1.Verdict.FAILED;
|
|
31
|
+
test.resultCode = 'F1';
|
|
32
|
+
}
|
|
33
|
+
test.addElement(element);
|
|
34
|
+
this.addTestResult(test);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.QW_BP23 = QW_BP23;
|
|
38
|
+
__decorate([
|
|
39
|
+
applicability_1.ElementExists,
|
|
40
|
+
applicability_1.ElementIsInAccessibilityTree,
|
|
41
|
+
__metadata("design:type", Function),
|
|
42
|
+
__metadata("design:paramtypes", [Function]),
|
|
43
|
+
__metadata("design:returntype", void 0)
|
|
44
|
+
], QW_BP23.prototype, "execute", null);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QW-BP24.d.ts","sourceRoot":"","sources":["../../src/best-practices/QW-BP24.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,cAAM,OAAQ,SAAQ,YAAY;IAGhC,OAAO,CAAC,OAAO,EAAE,SAAS,GAAG,IAAI;CAsBlC;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.QW_BP24 = void 0;
|
|
13
|
+
const applicability_1 = require("@qualweb/util/applicability");
|
|
14
|
+
const evaluation_1 = require("@qualweb/core/evaluation");
|
|
15
|
+
const BestPractice_object_1 = require("../lib/BestPractice.object");
|
|
16
|
+
class QW_BP24 extends BestPractice_object_1.BestPractice {
|
|
17
|
+
execute(element) {
|
|
18
|
+
const test = new evaluation_1.Test();
|
|
19
|
+
const children = element.getElementChildren();
|
|
20
|
+
let allChildrenValid = true;
|
|
21
|
+
children.map((child) => {
|
|
22
|
+
const role = window.AccessibilityUtils.getElementRole(child);
|
|
23
|
+
const name = child.getElementTagName();
|
|
24
|
+
if (name !== 'li' && role !== 'listitem') {
|
|
25
|
+
allChildrenValid = false;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
if (allChildrenValid) {
|
|
29
|
+
test.verdict = evaluation_1.Verdict.PASSED;
|
|
30
|
+
test.resultCode = 'P1';
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
test.verdict = evaluation_1.Verdict.FAILED;
|
|
34
|
+
test.resultCode = 'F1';
|
|
35
|
+
}
|
|
36
|
+
test.addElement(element);
|
|
37
|
+
this.addTestResult(test);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.QW_BP24 = QW_BP24;
|
|
41
|
+
__decorate([
|
|
42
|
+
applicability_1.ElementExists,
|
|
43
|
+
(0, applicability_1.ElementHasChild)('*'),
|
|
44
|
+
__metadata("design:type", Function),
|
|
45
|
+
__metadata("design:paramtypes", [Function]),
|
|
46
|
+
__metadata("design:returntype", void 0)
|
|
47
|
+
], QW_BP24.prototype, "execute", null);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QW-BP25.d.ts","sourceRoot":"","sources":["../../src/best-practices/QW-BP25.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,cAAM,OAAQ,SAAQ,YAAY;IAEhC,OAAO,CAAC,OAAO,EAAE,SAAS,GAAG,IAAI;CAclC;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.QW_BP25 = void 0;
|
|
13
|
+
const applicability_1 = require("@qualweb/util/applicability");
|
|
14
|
+
const evaluation_1 = require("@qualweb/core/evaluation");
|
|
15
|
+
const BestPractice_object_1 = require("../lib/BestPractice.object");
|
|
16
|
+
class QW_BP25 extends BestPractice_object_1.BestPractice {
|
|
17
|
+
execute(element) {
|
|
18
|
+
const test = new evaluation_1.Test();
|
|
19
|
+
const isTopLevel = window.AccessibilityUtils.landmarkIsTopLevel(element);
|
|
20
|
+
if (isTopLevel) {
|
|
21
|
+
test.verdict = evaluation_1.Verdict.PASSED;
|
|
22
|
+
test.resultCode = 'P1';
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
test.verdict = evaluation_1.Verdict.FAILED;
|
|
26
|
+
test.resultCode = 'F1';
|
|
27
|
+
}
|
|
28
|
+
test.addElement(element);
|
|
29
|
+
this.addTestResult(test);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.QW_BP25 = QW_BP25;
|
|
33
|
+
__decorate([
|
|
34
|
+
applicability_1.ElementExists,
|
|
35
|
+
__metadata("design:type", Function),
|
|
36
|
+
__metadata("design:paramtypes", [Function]),
|
|
37
|
+
__metadata("design:returntype", void 0)
|
|
38
|
+
], QW_BP25.prototype, "execute", null);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QW-BP26.d.ts","sourceRoot":"","sources":["../../src/best-practices/QW-BP26.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,cAAM,OAAQ,SAAQ,YAAY;IAEhC,OAAO,CAAC,OAAO,EAAE,SAAS,GAAG,IAAI;CAclC;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.QW_BP26 = void 0;
|
|
13
|
+
const applicability_1 = require("@qualweb/util/applicability");
|
|
14
|
+
const evaluation_1 = require("@qualweb/core/evaluation");
|
|
15
|
+
const BestPractice_object_1 = require("../lib/BestPractice.object");
|
|
16
|
+
class QW_BP26 extends BestPractice_object_1.BestPractice {
|
|
17
|
+
execute(element) {
|
|
18
|
+
const test = new evaluation_1.Test();
|
|
19
|
+
const isTopLevel = window.AccessibilityUtils.landmarkIsTopLevel(element);
|
|
20
|
+
if (isTopLevel) {
|
|
21
|
+
test.verdict = evaluation_1.Verdict.PASSED;
|
|
22
|
+
test.resultCode = 'P1';
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
test.verdict = evaluation_1.Verdict.FAILED;
|
|
26
|
+
test.resultCode = 'F1';
|
|
27
|
+
}
|
|
28
|
+
test.addElement(element);
|
|
29
|
+
this.addTestResult(test);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.QW_BP26 = QW_BP26;
|
|
33
|
+
__decorate([
|
|
34
|
+
applicability_1.ElementExists,
|
|
35
|
+
__metadata("design:type", Function),
|
|
36
|
+
__metadata("design:paramtypes", [Function]),
|
|
37
|
+
__metadata("design:returntype", void 0)
|
|
38
|
+
], QW_BP26.prototype, "execute", null);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QW-BP27.d.ts","sourceRoot":"","sources":["../../src/best-practices/QW-BP27.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,cAAM,OAAQ,SAAQ,YAAY;IAEhC,OAAO,CAAC,OAAO,EAAE,SAAS,GAAG,IAAI;CAclC;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.QW_BP27 = void 0;
|
|
13
|
+
const applicability_1 = require("@qualweb/util/applicability");
|
|
14
|
+
const evaluation_1 = require("@qualweb/core/evaluation");
|
|
15
|
+
const BestPractice_object_1 = require("../lib/BestPractice.object");
|
|
16
|
+
class QW_BP27 extends BestPractice_object_1.BestPractice {
|
|
17
|
+
execute(element) {
|
|
18
|
+
const test = new evaluation_1.Test();
|
|
19
|
+
const isTopLevel = window.AccessibilityUtils.landmarkIsTopLevel(element);
|
|
20
|
+
if (isTopLevel) {
|
|
21
|
+
test.verdict = evaluation_1.Verdict.PASSED;
|
|
22
|
+
test.resultCode = 'P1';
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
test.verdict = evaluation_1.Verdict.FAILED;
|
|
26
|
+
test.resultCode = 'F1';
|
|
27
|
+
}
|
|
28
|
+
test.addElement(element);
|
|
29
|
+
this.addTestResult(test);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.QW_BP27 = QW_BP27;
|
|
33
|
+
__decorate([
|
|
34
|
+
applicability_1.ElementExists,
|
|
35
|
+
__metadata("design:type", Function),
|
|
36
|
+
__metadata("design:paramtypes", [Function]),
|
|
37
|
+
__metadata("design:returntype", void 0)
|
|
38
|
+
], QW_BP27.prototype, "execute", null);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QW-BP28.d.ts","sourceRoot":"","sources":["../../src/best-practices/QW-BP28.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,cAAM,OAAQ,SAAQ,YAAY;IAEhC,OAAO,CAAC,OAAO,EAAE,SAAS,GAAG,IAAI;CAoBlC;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.QW_BP28 = void 0;
|
|
13
|
+
const applicability_1 = require("@qualweb/util/applicability");
|
|
14
|
+
const evaluation_1 = require("@qualweb/core/evaluation");
|
|
15
|
+
const BestPractice_object_1 = require("../lib/BestPractice.object");
|
|
16
|
+
class QW_BP28 extends BestPractice_object_1.BestPractice {
|
|
17
|
+
execute(element) {
|
|
18
|
+
let verdict;
|
|
19
|
+
let resultCode;
|
|
20
|
+
const hasH1 = element.getElements('h1');
|
|
21
|
+
if (hasH1.length === 1) {
|
|
22
|
+
verdict = evaluation_1.Verdict.PASSED;
|
|
23
|
+
resultCode = 'P1';
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
verdict = evaluation_1.Verdict.FAILED;
|
|
27
|
+
resultCode = 'F1';
|
|
28
|
+
}
|
|
29
|
+
hasH1.forEach((element) => {
|
|
30
|
+
const test = new evaluation_1.Test();
|
|
31
|
+
test.verdict = verdict;
|
|
32
|
+
test.resultCode = resultCode;
|
|
33
|
+
test.addElement(element);
|
|
34
|
+
this.addTestResult(test);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.QW_BP28 = QW_BP28;
|
|
39
|
+
__decorate([
|
|
40
|
+
applicability_1.ElementExists,
|
|
41
|
+
__metadata("design:type", Function),
|
|
42
|
+
__metadata("design:paramtypes", [Function]),
|
|
43
|
+
__metadata("design:returntype", void 0)
|
|
44
|
+
], QW_BP28.prototype, "execute", null);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QW-BP29.d.ts","sourceRoot":"","sources":["../../src/best-practices/QW-BP29.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAShD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,cAAM,OAAQ,SAAQ,YAAY;IAQhC,OAAO,CAAC,OAAO,EAAE,SAAS,GAAG,IAAI;CAmBlC;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.QW_BP29 = void 0;
|
|
13
|
+
const qw_element_1 = require("@qualweb/qw-element");
|
|
14
|
+
const applicability_1 = require("@qualweb/util/applicability");
|
|
15
|
+
const evaluation_1 = require("@qualweb/core/evaluation");
|
|
16
|
+
const BestPractice_object_1 = require("../lib/BestPractice.object");
|
|
17
|
+
class QW_BP29 extends BestPractice_object_1.BestPractice {
|
|
18
|
+
execute(element) {
|
|
19
|
+
const lang = element.getElementAttribute('lang');
|
|
20
|
+
const xmlLang = element.getElementAttribute('xml:lang');
|
|
21
|
+
const primaryLang = lang.split('-')[0];
|
|
22
|
+
const primaryXmlLang = xmlLang.split('-')[0];
|
|
23
|
+
const test = new evaluation_1.Test();
|
|
24
|
+
if (primaryLang.toLowerCase() === primaryXmlLang.toLowerCase()) {
|
|
25
|
+
test.verdict = evaluation_1.Verdict.PASSED;
|
|
26
|
+
test.resultCode = 'P1';
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
test.verdict = evaluation_1.Verdict.FAILED;
|
|
30
|
+
test.resultCode = 'F1';
|
|
31
|
+
}
|
|
32
|
+
test.addElement(element);
|
|
33
|
+
this.addTestResult(test);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.QW_BP29 = QW_BP29;
|
|
37
|
+
__decorate([
|
|
38
|
+
applicability_1.ElementExists,
|
|
39
|
+
applicability_1.IsHTMLDocument,
|
|
40
|
+
applicability_1.IsInMainContext,
|
|
41
|
+
(0, applicability_1.ElementHasNonEmptyAttribute)('lang'),
|
|
42
|
+
(0, applicability_1.ElementHasNonEmptyAttribute)('xml:lang'),
|
|
43
|
+
(0, applicability_1.IsLangSubTagValid)('lang'),
|
|
44
|
+
(0, applicability_1.IsLangSubTagValid)('xml:lang'),
|
|
45
|
+
__metadata("design:type", Function),
|
|
46
|
+
__metadata("design:paramtypes", [qw_element_1.QWElement]),
|
|
47
|
+
__metadata("design:returntype", void 0)
|
|
48
|
+
], QW_BP29.prototype, "execute", null);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QW-BP4.d.ts","sourceRoot":"","sources":["../../src/best-practices/QW-BP4.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,cAAM,MAAO,SAAQ,YAAY;IAG/B,OAAO,CAAC,OAAO,EAAE,SAAS,GAAG,IAAI;CAYlC;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}
|