@qualweb/act-rules 0.0.0-develop-20231124154536 → 0.0.0-develop-20241204125016
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 +109 -76
- package/dist/ACTRulesModule.d.ts +11 -0
- package/dist/ACTRulesModule.d.ts.map +1 -0
- package/dist/ACTRulesModule.js +65 -0
- package/dist/ACTRulesRunner.d.ts +14 -0
- package/dist/ACTRulesRunner.d.ts.map +1 -0
- package/dist/ACTRulesRunner.js +44 -0
- package/dist/__webpack/act.bundle.js +1 -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/ACTRulesTester.object.d.ts +15 -0
- package/dist/lib/ACTRulesTester.object.d.ts.map +1 -0
- package/dist/lib/ACTRulesTester.object.js +150 -0
- package/dist/lib/AtomicRule.object.d.ts +7 -0
- package/dist/lib/AtomicRule.object.d.ts.map +1 -0
- package/dist/lib/AtomicRule.object.js +7 -0
- package/dist/lib/CompositeRule.object.d.ts +13 -0
- package/dist/lib/CompositeRule.object.d.ts.map +1 -0
- package/dist/lib/CompositeRule.object.js +80 -0
- package/dist/lib/Rule.object.d.ts +19 -0
- package/dist/lib/Rule.object.d.ts.map +1 -0
- package/dist/lib/Rule.object.js +76 -0
- package/dist/lib/mapping.d.ts +36 -0
- package/dist/lib/mapping.d.ts.map +1 -0
- package/dist/lib/mapping.js +38 -0
- package/dist/lib/mappingComposite.d.ts +39 -0
- package/dist/lib/mappingComposite.d.ts.map +1 -0
- package/dist/lib/mappingComposite.js +23 -0
- package/dist/lib/rules.json +1523 -0
- package/dist/lib/types.d.ts +15 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/types.js +2 -0
- package/dist/rules/QW-ACT-R1.d.ts +7 -0
- package/dist/rules/QW-ACT-R1.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R1.js +49 -0
- package/dist/rules/QW-ACT-R10.d.ts +8 -0
- package/dist/rules/QW-ACT-R10.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R10.js +98 -0
- package/dist/rules/QW-ACT-R11.d.ts +7 -0
- package/dist/rules/QW-ACT-R11.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R11.js +40 -0
- package/dist/rules/QW-ACT-R12.d.ts +7 -0
- package/dist/rules/QW-ACT-R12.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R12.js +40 -0
- package/dist/rules/QW-ACT-R13.d.ts +9 -0
- package/dist/rules/QW-ACT-R13.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R13.js +76 -0
- package/dist/rules/QW-ACT-R14.d.ts +7 -0
- package/dist/rules/QW-ACT-R14.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R14.js +73 -0
- package/dist/rules/QW-ACT-R15.d.ts +6 -0
- package/dist/rules/QW-ACT-R15.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R15.js +26 -0
- package/dist/rules/QW-ACT-R16.d.ts +7 -0
- package/dist/rules/QW-ACT-R16.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R16.js +52 -0
- package/dist/rules/QW-ACT-R17.d.ts +7 -0
- package/dist/rules/QW-ACT-R17.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R17.js +52 -0
- package/dist/rules/QW-ACT-R19.d.ts +7 -0
- package/dist/rules/QW-ACT-R19.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R19.js +42 -0
- package/dist/rules/QW-ACT-R2.d.ts +7 -0
- package/dist/rules/QW-ACT-R2.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R2.js +40 -0
- package/dist/rules/QW-ACT-R20.d.ts +7 -0
- package/dist/rules/QW-ACT-R20.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R20.js +39 -0
- package/dist/rules/QW-ACT-R21.d.ts +8 -0
- package/dist/rules/QW-ACT-R21.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R21.js +50 -0
- package/dist/rules/QW-ACT-R22.d.ts +9 -0
- package/dist/rules/QW-ACT-R22.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R22.js +69 -0
- package/dist/rules/QW-ACT-R23.d.ts +6 -0
- package/dist/rules/QW-ACT-R23.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R23.js +26 -0
- package/dist/rules/QW-ACT-R24.d.ts +12 -0
- package/dist/rules/QW-ACT-R24.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R24.js +298 -0
- package/dist/rules/QW-ACT-R25.d.ts +7 -0
- package/dist/rules/QW-ACT-R25.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R25.js +67 -0
- package/dist/rules/QW-ACT-R26.d.ts +6 -0
- package/dist/rules/QW-ACT-R26.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R26.js +26 -0
- package/dist/rules/QW-ACT-R27.d.ts +7 -0
- package/dist/rules/QW-ACT-R27.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R27.js +55 -0
- package/dist/rules/QW-ACT-R28.d.ts +7 -0
- package/dist/rules/QW-ACT-R28.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R28.js +83 -0
- package/dist/rules/QW-ACT-R29.d.ts +6 -0
- package/dist/rules/QW-ACT-R29.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R29.js +26 -0
- package/dist/rules/QW-ACT-R30.d.ts +9 -0
- package/dist/rules/QW-ACT-R30.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R30.js +69 -0
- package/dist/rules/QW-ACT-R31.d.ts +6 -0
- package/dist/rules/QW-ACT-R31.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R31.js +26 -0
- package/dist/rules/QW-ACT-R32.d.ts +6 -0
- package/dist/rules/QW-ACT-R32.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R32.js +26 -0
- package/dist/rules/QW-ACT-R33.d.ts +8 -0
- package/dist/rules/QW-ACT-R33.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R33.js +89 -0
- package/dist/rules/QW-ACT-R34.d.ts +7 -0
- package/dist/rules/QW-ACT-R34.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R34.js +112 -0
- package/dist/rules/QW-ACT-R35.d.ts +7 -0
- package/dist/rules/QW-ACT-R35.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R35.js +40 -0
- package/dist/rules/QW-ACT-R36.d.ts +7 -0
- package/dist/rules/QW-ACT-R36.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R36.js +108 -0
- package/dist/rules/QW-ACT-R37.d.ts +23 -0
- package/dist/rules/QW-ACT-R37.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R37.js +358 -0
- package/dist/rules/QW-ACT-R38.d.ts +9 -0
- package/dist/rules/QW-ACT-R38.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R38.js +100 -0
- package/dist/rules/QW-ACT-R39.d.ts +8 -0
- package/dist/rules/QW-ACT-R39.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R39.js +155 -0
- package/dist/rules/QW-ACT-R4.d.ts +8 -0
- package/dist/rules/QW-ACT-R4.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R4.js +85 -0
- package/dist/rules/QW-ACT-R40.d.ts +7 -0
- package/dist/rules/QW-ACT-R40.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R40.js +58 -0
- package/dist/rules/QW-ACT-R41.d.ts +7 -0
- package/dist/rules/QW-ACT-R41.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R41.js +42 -0
- package/dist/rules/QW-ACT-R42.d.ts +7 -0
- package/dist/rules/QW-ACT-R42.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R42.js +40 -0
- package/dist/rules/QW-ACT-R43.d.ts +8 -0
- package/dist/rules/QW-ACT-R43.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R43.js +98 -0
- package/dist/rules/QW-ACT-R44.d.ts +8 -0
- package/dist/rules/QW-ACT-R44.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R44.js +92 -0
- package/dist/rules/QW-ACT-R48.d.ts +7 -0
- package/dist/rules/QW-ACT-R48.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R48.js +38 -0
- package/dist/rules/QW-ACT-R49.d.ts +8 -0
- package/dist/rules/QW-ACT-R49.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R49.js +83 -0
- package/dist/rules/QW-ACT-R5.d.ts +8 -0
- package/dist/rules/QW-ACT-R5.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R5.js +44 -0
- package/dist/rules/QW-ACT-R50.d.ts +8 -0
- package/dist/rules/QW-ACT-R50.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R50.js +76 -0
- package/dist/rules/QW-ACT-R51.d.ts +7 -0
- package/dist/rules/QW-ACT-R51.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R51.js +41 -0
- package/dist/rules/QW-ACT-R53.d.ts +7 -0
- package/dist/rules/QW-ACT-R53.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R53.js +41 -0
- package/dist/rules/QW-ACT-R54.d.ts +7 -0
- package/dist/rules/QW-ACT-R54.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R54.js +41 -0
- package/dist/rules/QW-ACT-R55.d.ts +7 -0
- package/dist/rules/QW-ACT-R55.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R55.js +41 -0
- package/dist/rules/QW-ACT-R56.d.ts +7 -0
- package/dist/rules/QW-ACT-R56.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R56.js +41 -0
- package/dist/rules/QW-ACT-R58.d.ts +7 -0
- package/dist/rules/QW-ACT-R58.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R58.js +33 -0
- package/dist/rules/QW-ACT-R59.d.ts +7 -0
- package/dist/rules/QW-ACT-R59.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R59.js +33 -0
- package/dist/rules/QW-ACT-R6.d.ts +7 -0
- package/dist/rules/QW-ACT-R6.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R6.js +40 -0
- package/dist/rules/QW-ACT-R60.d.ts +7 -0
- package/dist/rules/QW-ACT-R60.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R60.js +41 -0
- package/dist/rules/QW-ACT-R61.d.ts +7 -0
- package/dist/rules/QW-ACT-R61.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R61.js +41 -0
- package/dist/rules/QW-ACT-R62.d.ts +7 -0
- package/dist/rules/QW-ACT-R62.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R62.js +37 -0
- package/dist/rules/QW-ACT-R63.d.ts +8 -0
- package/dist/rules/QW-ACT-R63.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R63.js +60 -0
- package/dist/rules/QW-ACT-R64.d.ts +8 -0
- package/dist/rules/QW-ACT-R64.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R64.js +60 -0
- package/dist/rules/QW-ACT-R65.d.ts +7 -0
- package/dist/rules/QW-ACT-R65.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R65.js +58 -0
- package/dist/rules/QW-ACT-R66.d.ts +7 -0
- package/dist/rules/QW-ACT-R66.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R66.js +40 -0
- package/dist/rules/QW-ACT-R67.d.ts +12 -0
- package/dist/rules/QW-ACT-R67.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R67.js +94 -0
- package/dist/rules/QW-ACT-R68.d.ts +14 -0
- package/dist/rules/QW-ACT-R68.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R68.js +117 -0
- package/dist/rules/QW-ACT-R69.d.ts +12 -0
- package/dist/rules/QW-ACT-R69.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R69.js +94 -0
- package/dist/rules/QW-ACT-R7.d.ts +14 -0
- package/dist/rules/QW-ACT-R7.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R7.js +167 -0
- package/dist/rules/QW-ACT-R70.d.ts +7 -0
- package/dist/rules/QW-ACT-R70.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R70.js +52 -0
- package/dist/rules/QW-ACT-R71.d.ts +8 -0
- package/dist/rules/QW-ACT-R71.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R71.js +81 -0
- package/dist/rules/QW-ACT-R73.d.ts +8 -0
- package/dist/rules/QW-ACT-R73.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R73.js +60 -0
- package/dist/rules/QW-ACT-R74.d.ts +8 -0
- package/dist/rules/QW-ACT-R74.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R74.js +80 -0
- package/dist/rules/QW-ACT-R75.d.ts +6 -0
- package/dist/rules/QW-ACT-R75.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R75.js +27 -0
- package/dist/rules/QW-ACT-R76.d.ts +23 -0
- package/dist/rules/QW-ACT-R76.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R76.js +336 -0
- package/dist/rules/QW-ACT-R77.d.ts +7 -0
- package/dist/rules/QW-ACT-R77.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R77.js +53 -0
- package/dist/rules/QW-ACT-R9.d.ts +7 -0
- package/dist/rules/QW-ACT-R9.d.ts.map +1 -0
- package/dist/rules/QW-ACT-R9.js +87 -0
- package/dist/rules/index.d.ts +69 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +84 -0
- package/package.json +30 -27
- package/dist/act.bundle.js +0 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { QWElement } from '@qualweb/qw-element';
|
|
2
|
+
import { Test } from '@qualweb/core/evaluation';
|
|
3
|
+
import { AtomicRule } from '../lib/AtomicRule.object';
|
|
4
|
+
declare class QW_ACT_R76 extends AtomicRule {
|
|
5
|
+
execute(element: QWElement): void;
|
|
6
|
+
getBackground(element: QWElement): string;
|
|
7
|
+
isImage(color: string): boolean;
|
|
8
|
+
evaluateGradient(test: Test, element: QWElement, parsedGradientString: any, fgColor: any, opacity: number, fontSize: string, fontWeight: string, fontStyle: string, fontFamily: string, elementText: string): boolean;
|
|
9
|
+
isHumanLanguage(text: string): boolean;
|
|
10
|
+
equals(color1: any, color2: any): boolean;
|
|
11
|
+
getGradientDirection(gradient: string): string | undefined;
|
|
12
|
+
parseGradientString(gradient: string, opacity: number): any;
|
|
13
|
+
parseRGBString(colorString: string, opacity: number): any;
|
|
14
|
+
getRelativeLuminance(red: number, green: number, blue: number): number;
|
|
15
|
+
flattenColors(fgColor: any, bgColor: any): any;
|
|
16
|
+
private isBold;
|
|
17
|
+
getContrast(bgColor: any, fgColor: any): number;
|
|
18
|
+
hasValidContrastRatio(contrast: number, fontSize: string, isBold: boolean): boolean;
|
|
19
|
+
getTextSize(font: string, fontSize: number, bold: boolean, italic: boolean, text: string): number;
|
|
20
|
+
getColorInGradient(fromColor: any, toColor: any, ratio: number): any;
|
|
21
|
+
}
|
|
22
|
+
export { QW_ACT_R76 };
|
|
23
|
+
//# sourceMappingURL=QW-ACT-R76.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QW-ACT-R76.d.ts","sourceRoot":"","sources":["../../src/rules/QW-ACT-R76.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAQrD,OAAO,EAAE,IAAI,EAAW,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,cAAM,UAAW,SAAQ,UAAU;IAMjC,OAAO,CAAC,OAAO,EAAE,SAAS,GAAG,IAAI;IAwMjC,aAAa,CAAC,OAAO,EAAE,SAAS,GAAG,MAAM;IAczC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAS/B,gBAAgB,CACd,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,SAAS,EAClB,oBAAoB,EAAE,GAAG,EACzB,OAAO,EAAE,GAAG,EACZ,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GAClB,OAAO;IAoDV,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAItC,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO;IASzC,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAY1D,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,GAAG;IAW3D,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,GAAG;IAiCzD,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAYtE,aAAa,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,GAAG,GAAG;IAU9C,OAAO,CAAC,MAAM;IAId,WAAW,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,GAAG,MAAM;IAW/C,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO;IAWnF,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAIjG,kBAAkB,CAAC,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,GAAG,GAAG;CAOrE;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,336 @@
|
|
|
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_ACT_R76 = void 0;
|
|
13
|
+
const applicability_1 = require("@qualweb/util/applicability");
|
|
14
|
+
const evaluation_1 = require("@qualweb/core/evaluation");
|
|
15
|
+
const AtomicRule_object_1 = require("../lib/AtomicRule.object");
|
|
16
|
+
class QW_ACT_R76 extends AtomicRule_object_1.AtomicRule {
|
|
17
|
+
execute(element) {
|
|
18
|
+
const disabledWidgets = window.disabledWidgets;
|
|
19
|
+
const test = new evaluation_1.Test();
|
|
20
|
+
const visible = window.DomUtils.isElementVisible(element);
|
|
21
|
+
if (!visible) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const hasTextNode = element.hasTextNode();
|
|
25
|
+
const elementText = element.getElementOwnText();
|
|
26
|
+
if (!hasTextNode && elementText.trim() === '') {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const isHTML = element.isElementHTMLElement();
|
|
30
|
+
if (!isHTML) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const elementSelectors = element.getElementSelector();
|
|
34
|
+
for (const disableWidget of disabledWidgets || []) {
|
|
35
|
+
const selectors = window.AccessibilityUtils.getAccessibleNameSelector(disableWidget);
|
|
36
|
+
if (disableWidget && selectors && selectors.includes(elementSelectors)) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (disableWidget.getElementSelector() === elementSelectors) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const role = window.AccessibilityUtils.getElementRole(element);
|
|
44
|
+
if (role === 'group') {
|
|
45
|
+
const disable = element.getElementAttribute('disabled') !== null;
|
|
46
|
+
const ariaDisable = element.getElementAttribute('aria-disabled') !== null;
|
|
47
|
+
if (disable || ariaDisable) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const fgColor = element.getElementStyleProperty('color', null);
|
|
52
|
+
let bgColor = this.getBackground(element);
|
|
53
|
+
const opacity = parseFloat(element.getElementStyleProperty('opacity', null));
|
|
54
|
+
const fontSize = element.getElementStyleProperty('font-size', null);
|
|
55
|
+
const fontWeight = element.getElementStyleProperty('font-weight', null);
|
|
56
|
+
const fontFamily = element.getElementStyleProperty('font-family', null);
|
|
57
|
+
const fontStyle = element.getElementStyleProperty('font-style', null);
|
|
58
|
+
const textShadow = element.getElementStyleProperty('text-shadow', null);
|
|
59
|
+
if (textShadow.trim() !== 'none') {
|
|
60
|
+
const properties = textShadow.trim().split(' ');
|
|
61
|
+
if (properties.length === 6) {
|
|
62
|
+
const vs = parseInt(properties[3], 0);
|
|
63
|
+
const hs = parseInt(properties[4], 0);
|
|
64
|
+
const blur = parseInt(properties[5], 0);
|
|
65
|
+
const validateTextShadow = vs === 0 && hs === 0 && blur > 0 && blur <= 15;
|
|
66
|
+
if (validateTextShadow) {
|
|
67
|
+
test.verdict = evaluation_1.Verdict.WARNING;
|
|
68
|
+
test.resultCode = 'W1';
|
|
69
|
+
test.addElement(element);
|
|
70
|
+
this.addTestResult(test);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (this.isImage(bgColor)) {
|
|
76
|
+
test.verdict = evaluation_1.Verdict.WARNING;
|
|
77
|
+
test.resultCode = 'W2';
|
|
78
|
+
test.addElement(element);
|
|
79
|
+
this.addTestResult(test);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const regexGradient = /((\w-?)*gradient.*)/gm;
|
|
83
|
+
let regexGradientMatches = bgColor.match(regexGradient);
|
|
84
|
+
if (regexGradientMatches) {
|
|
85
|
+
if (this.isHumanLanguage(elementText)) {
|
|
86
|
+
const parsedGradientString = regexGradientMatches[0];
|
|
87
|
+
this.evaluateGradient(test, element, parsedGradientString, fgColor, opacity, fontSize, fontWeight, fontStyle, fontFamily, elementText);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
test.verdict = evaluation_1.Verdict.PASSED;
|
|
91
|
+
test.resultCode = 'P2';
|
|
92
|
+
test.addElement(element);
|
|
93
|
+
this.addTestResult(test);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
let parsedBG = this.parseRGBString(bgColor, opacity);
|
|
98
|
+
let elementAux = element;
|
|
99
|
+
let opacityAUX;
|
|
100
|
+
while (parsedBG === undefined ||
|
|
101
|
+
(parsedBG.red === 0 && parsedBG.green === 0 && parsedBG.blue === 0 && parsedBG.alpha === 0)) {
|
|
102
|
+
const parent = elementAux.getElementParent();
|
|
103
|
+
if (parent) {
|
|
104
|
+
bgColor = this.getBackground(parent);
|
|
105
|
+
if (this.isImage(bgColor)) {
|
|
106
|
+
test.verdict = evaluation_1.Verdict.WARNING;
|
|
107
|
+
test.resultCode = 'W2';
|
|
108
|
+
test.addElement(element);
|
|
109
|
+
this.addTestResult(test);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
regexGradientMatches = bgColor.match(regexGradient);
|
|
114
|
+
if (regexGradientMatches) {
|
|
115
|
+
const parsedGradientString = regexGradientMatches[0];
|
|
116
|
+
if (this.evaluateGradient(test, element, parsedGradientString, fgColor, opacity, fontSize, fontWeight, fontStyle, fontFamily, elementText)) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
opacityAUX = parseFloat(parent.getElementStyleProperty('opacity', null));
|
|
122
|
+
parsedBG = this.parseRGBString(parent.getElementStyleProperty('background', null), opacityAUX);
|
|
123
|
+
elementAux = parent;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (parsedBG === undefined ||
|
|
132
|
+
(parsedBG.red === 0 && parsedBG.green === 0 && parsedBG.blue === 0 && parsedBG.alpha === 0)) {
|
|
133
|
+
parsedBG = { red: 255, green: 255, blue: 255, alpha: 1 };
|
|
134
|
+
}
|
|
135
|
+
const parsedFG = this.parseRGBString(fgColor, opacity);
|
|
136
|
+
if (!this.equals(parsedBG, parsedFG)) {
|
|
137
|
+
if (this.isHumanLanguage(elementText)) {
|
|
138
|
+
const contrastRatio = this.getContrast(parsedBG, parsedFG);
|
|
139
|
+
const isValid = this.hasValidContrastRatio(contrastRatio, fontSize, this.isBold(fontWeight));
|
|
140
|
+
if (isValid) {
|
|
141
|
+
test.verdict = evaluation_1.Verdict.PASSED;
|
|
142
|
+
test.resultCode = 'P1';
|
|
143
|
+
test.addElement(element);
|
|
144
|
+
this.addTestResult(test);
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
test.verdict = evaluation_1.Verdict.FAILED;
|
|
148
|
+
test.resultCode = 'F1';
|
|
149
|
+
test.addElement(element);
|
|
150
|
+
this.addTestResult(test);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
test.verdict = evaluation_1.Verdict.PASSED;
|
|
155
|
+
test.resultCode = 'P2';
|
|
156
|
+
test.addElement(element);
|
|
157
|
+
this.addTestResult(test);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
getBackground(element) {
|
|
163
|
+
const backgroundImage = element.getElementStyleProperty('background-image', null);
|
|
164
|
+
if (backgroundImage === 'none') {
|
|
165
|
+
let bg = element.getElementStyleProperty('background', null);
|
|
166
|
+
if (bg === '') {
|
|
167
|
+
bg = element.getElementStyleProperty('background-color', null);
|
|
168
|
+
}
|
|
169
|
+
return bg;
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
return backgroundImage;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
isImage(color) {
|
|
176
|
+
return (color.toLowerCase().includes('.jpeg') ||
|
|
177
|
+
color.toLowerCase().includes('.jpg') ||
|
|
178
|
+
color.toLowerCase().includes('.png') ||
|
|
179
|
+
color.toLowerCase().includes('.svg'));
|
|
180
|
+
}
|
|
181
|
+
evaluateGradient(test, element, parsedGradientString, fgColor, opacity, fontSize, fontWeight, fontStyle, fontFamily, elementText) {
|
|
182
|
+
if (parsedGradientString.startsWith('linear-gradient')) {
|
|
183
|
+
const gradientDirection = this.getGradientDirection(parsedGradientString);
|
|
184
|
+
if (gradientDirection === 'to right') {
|
|
185
|
+
const colors = this.parseGradientString(parsedGradientString, opacity);
|
|
186
|
+
let isValid = true;
|
|
187
|
+
let contrastRatio;
|
|
188
|
+
const textSize = this.getTextSize(fontFamily.toLowerCase().replace(/['"]+/g, ''), parseInt(fontSize.replace('px', '')), this.isBold(fontWeight), fontStyle.toLowerCase().includes('italic'), elementText);
|
|
189
|
+
if (textSize !== -1) {
|
|
190
|
+
const elementWidth = element.getElementStyleProperty('width', null);
|
|
191
|
+
const lastCharRatio = textSize / parseInt(elementWidth.replace('px', ''));
|
|
192
|
+
const lastCharBgColor = this.getColorInGradient(colors[0], colors[colors.length - 1], lastCharRatio);
|
|
193
|
+
contrastRatio = this.getContrast(colors[0], this.parseRGBString(fgColor, opacity));
|
|
194
|
+
isValid = isValid && this.hasValidContrastRatio(contrastRatio, fontSize, this.isBold(fontWeight));
|
|
195
|
+
contrastRatio = this.getContrast(lastCharBgColor, this.parseRGBString(fgColor, opacity));
|
|
196
|
+
isValid = isValid && this.hasValidContrastRatio(contrastRatio, fontSize, this.isBold(fontWeight));
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
for (const color of colors) {
|
|
200
|
+
contrastRatio = this.getContrast(color, this.parseRGBString(fgColor, opacity));
|
|
201
|
+
isValid = isValid && this.hasValidContrastRatio(contrastRatio, fontSize, this.isBold(fontWeight));
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
if (isValid) {
|
|
205
|
+
test.verdict = evaluation_1.Verdict.PASSED;
|
|
206
|
+
test.resultCode = 'P3';
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
test.verdict = evaluation_1.Verdict.FAILED;
|
|
210
|
+
test.resultCode = 'F2';
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
else if (gradientDirection === 'to left') {
|
|
214
|
+
test.verdict = evaluation_1.Verdict.WARNING;
|
|
215
|
+
test.resultCode = 'W3';
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
test.verdict = evaluation_1.Verdict.WARNING;
|
|
219
|
+
test.resultCode = 'W3';
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
test.resultCode = 'W3';
|
|
224
|
+
}
|
|
225
|
+
test.addElement(element);
|
|
226
|
+
this.addTestResult(test);
|
|
227
|
+
return true;
|
|
228
|
+
}
|
|
229
|
+
isHumanLanguage(text) {
|
|
230
|
+
return window.DomUtils.isHumanLanguage(text);
|
|
231
|
+
}
|
|
232
|
+
equals(color1, color2) {
|
|
233
|
+
return (color1.red === color2.red &&
|
|
234
|
+
color1.green === color2.green &&
|
|
235
|
+
color1.blue === color2.blue &&
|
|
236
|
+
color1.alpha === color2.alpha);
|
|
237
|
+
}
|
|
238
|
+
getGradientDirection(gradient) {
|
|
239
|
+
const direction = gradient.replace('linear-gradient(', '').split(',')[0];
|
|
240
|
+
if (direction) {
|
|
241
|
+
if (direction === '90deg')
|
|
242
|
+
return 'to right';
|
|
243
|
+
if (direction === '-90deg')
|
|
244
|
+
return 'to left';
|
|
245
|
+
return direction;
|
|
246
|
+
}
|
|
247
|
+
return undefined;
|
|
248
|
+
}
|
|
249
|
+
parseGradientString(gradient, opacity) {
|
|
250
|
+
const regex = /rgb(a?)\((\d+), (\d+), (\d+)+(, +(\d)+)?\)/gm;
|
|
251
|
+
const colorsMatch = gradient.match(regex);
|
|
252
|
+
const colors = [];
|
|
253
|
+
for (const stringColor of colorsMatch || []) {
|
|
254
|
+
colors.push(this.parseRGBString(stringColor, opacity));
|
|
255
|
+
}
|
|
256
|
+
return colors;
|
|
257
|
+
}
|
|
258
|
+
parseRGBString(colorString, opacity) {
|
|
259
|
+
const rgbRegex = /^rgb\((\d+), (\d+), (\d+)\)/;
|
|
260
|
+
const rgbaRegex = /^rgba\((\d+), (\d+), (\d+), (\d*(\.\d+)?)\)/;
|
|
261
|
+
if (colorString === 'transparent') {
|
|
262
|
+
return { red: 0, green: 0, blue: 0, alpha: 0 };
|
|
263
|
+
}
|
|
264
|
+
let match = colorString.match(rgbRegex);
|
|
265
|
+
if (match) {
|
|
266
|
+
return {
|
|
267
|
+
red: parseInt(match[1], 10),
|
|
268
|
+
green: parseInt(match[2], 10),
|
|
269
|
+
blue: parseInt(match[3], 10),
|
|
270
|
+
alpha: opacity
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
match = colorString.match(rgbaRegex);
|
|
274
|
+
if (match) {
|
|
275
|
+
return {
|
|
276
|
+
red: parseInt(match[1], 10),
|
|
277
|
+
green: parseInt(match[2], 10),
|
|
278
|
+
blue: parseInt(match[3], 10),
|
|
279
|
+
alpha: Math.round(parseFloat(match[4]) * 100) / 100
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
getRelativeLuminance(red, green, blue) {
|
|
284
|
+
const rSRGB = red / 255;
|
|
285
|
+
const gSRGB = green / 255;
|
|
286
|
+
const bSRGB = blue / 255;
|
|
287
|
+
const r = rSRGB <= 0.03928 ? rSRGB / 12.92 : Math.pow((rSRGB + 0.055) / 1.055, 2.4);
|
|
288
|
+
const g = gSRGB <= 0.03928 ? gSRGB / 12.92 : Math.pow((gSRGB + 0.055) / 1.055, 2.4);
|
|
289
|
+
const b = bSRGB <= 0.03928 ? bSRGB / 12.92 : Math.pow((bSRGB + 0.055) / 1.055, 2.4);
|
|
290
|
+
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
291
|
+
}
|
|
292
|
+
flattenColors(fgColor, bgColor) {
|
|
293
|
+
const fgAlpha = fgColor['alpha'];
|
|
294
|
+
const red = (1 - fgAlpha) * bgColor['red'] + fgAlpha * fgColor['red'];
|
|
295
|
+
const green = (1 - fgAlpha) * bgColor['green'] + fgAlpha * fgColor['green'];
|
|
296
|
+
const blue = (1 - fgAlpha) * bgColor['blue'] + fgAlpha * fgColor['blue'];
|
|
297
|
+
const alpha = fgColor['alpha'] + bgColor['alpha'] * (1 - fgColor['alpha']);
|
|
298
|
+
return { red: red, green: green, blue: blue, alpha: alpha };
|
|
299
|
+
}
|
|
300
|
+
isBold(fontWeight) {
|
|
301
|
+
return !!fontWeight && ['bold', 'bolder', '700', '800', '900'].includes(fontWeight);
|
|
302
|
+
}
|
|
303
|
+
getContrast(bgColor, fgColor) {
|
|
304
|
+
if (fgColor.alpha < 1) {
|
|
305
|
+
fgColor = this.flattenColors(fgColor, bgColor);
|
|
306
|
+
}
|
|
307
|
+
const bL = this.getRelativeLuminance(bgColor['red'], bgColor['green'], bgColor['blue']);
|
|
308
|
+
const fL = this.getRelativeLuminance(fgColor['red'], fgColor['green'], fgColor['blue']);
|
|
309
|
+
return (Math.max(fL, bL) + 0.05) / (Math.min(fL, bL) + 0.05);
|
|
310
|
+
}
|
|
311
|
+
hasValidContrastRatio(contrast, fontSize, isBold) {
|
|
312
|
+
const isSmallFont = (isBold && parseFloat(fontSize) < 18.6667) || (!isBold && parseFloat(fontSize) < 24);
|
|
313
|
+
const expectedContrastRatio = isSmallFont ? 7 : 4.5;
|
|
314
|
+
return contrast >= expectedContrastRatio;
|
|
315
|
+
}
|
|
316
|
+
getTextSize(font, fontSize, bold, italic, text) {
|
|
317
|
+
return window.DomUtils.getTextSize(font, fontSize, bold, italic, text);
|
|
318
|
+
}
|
|
319
|
+
getColorInGradient(fromColor, toColor, ratio) {
|
|
320
|
+
const red = fromColor['red'] + (toColor['red'] - fromColor['red']) * ratio;
|
|
321
|
+
const green = fromColor['green'] + (toColor['green'] - fromColor['green']) * ratio;
|
|
322
|
+
const blue = fromColor['blue'] + (toColor['blue'] - fromColor['blue']) * ratio;
|
|
323
|
+
return { red: red, green: green, blue: blue, alpha: 1 };
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
exports.QW_ACT_R76 = QW_ACT_R76;
|
|
327
|
+
__decorate([
|
|
328
|
+
applicability_1.ElementExists,
|
|
329
|
+
applicability_1.ElementIsHTMLElement,
|
|
330
|
+
(0, applicability_1.ElementIsNot)(['html', 'head', 'body', 'script', 'style', 'meta']),
|
|
331
|
+
applicability_1.ElementIsVisible,
|
|
332
|
+
applicability_1.ElementHasText,
|
|
333
|
+
__metadata("design:type", Function),
|
|
334
|
+
__metadata("design:paramtypes", [Function]),
|
|
335
|
+
__metadata("design:returntype", void 0)
|
|
336
|
+
], QW_ACT_R76.prototype, "execute", null);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QW-ACT-R77.d.ts","sourceRoot":"","sources":["../../src/rules/QW-ACT-R77.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,cAAM,UAAW,SAAQ,UAAU;IAEjC,OAAO,CAAC,OAAO,EAAE,SAAS,GAAG,IAAI;CAwClC;AACD,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
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_ACT_R77 = void 0;
|
|
13
|
+
const applicability_1 = require("@qualweb/util/applicability");
|
|
14
|
+
const evaluation_1 = require("@qualweb/core/evaluation");
|
|
15
|
+
const AtomicRule_object_1 = require("../lib/AtomicRule.object");
|
|
16
|
+
class QW_ACT_R77 extends AtomicRule_object_1.AtomicRule {
|
|
17
|
+
execute(element) {
|
|
18
|
+
const role = element.getElementAttribute('role');
|
|
19
|
+
if (!(role === 'scrollbar' ||
|
|
20
|
+
(role === 'combobox' &&
|
|
21
|
+
element.getElementAttribute('aria-expanded') &&
|
|
22
|
+
element.getElementAttribute('aria-expanded') === 'true'))) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const test = new evaluation_1.Test();
|
|
26
|
+
const ariaControls = element.getElementAttribute('aria-controls');
|
|
27
|
+
const ids = ariaControls.split(' ');
|
|
28
|
+
let found = false;
|
|
29
|
+
for (const id of ids) {
|
|
30
|
+
if (document.getElementById(id)) {
|
|
31
|
+
found = true;
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (found) {
|
|
36
|
+
test.verdict = evaluation_1.Verdict.PASSED;
|
|
37
|
+
test.resultCode = 'P1';
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
test.verdict = evaluation_1.Verdict.FAILED;
|
|
41
|
+
test.resultCode = 'F1';
|
|
42
|
+
}
|
|
43
|
+
test.addElement(element, true, false, true);
|
|
44
|
+
this.addTestResult(test);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.QW_ACT_R77 = QW_ACT_R77;
|
|
48
|
+
__decorate([
|
|
49
|
+
applicability_1.ElementExists,
|
|
50
|
+
__metadata("design:type", Function),
|
|
51
|
+
__metadata("design:paramtypes", [Function]),
|
|
52
|
+
__metadata("design:returntype", void 0)
|
|
53
|
+
], QW_ACT_R77.prototype, "execute", null);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QW-ACT-R9.d.ts","sourceRoot":"","sources":["../../src/rules/QW-ACT-R9.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,cAAM,SAAU,SAAQ,UAAU;IAGhC,OAAO,IAAI,IAAI;IA2Df,OAAO,CAAC,mBAAmB;CAa5B;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
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_ACT_R9 = void 0;
|
|
13
|
+
const applicability_1 = require("@qualweb/util/applicability");
|
|
14
|
+
const evaluation_1 = require("@qualweb/core/evaluation");
|
|
15
|
+
const AtomicRule_object_1 = require("../lib/AtomicRule.object");
|
|
16
|
+
class QW_ACT_R9 extends AtomicRule_object_1.AtomicRule {
|
|
17
|
+
execute() {
|
|
18
|
+
const links = window.qwPage.getElements('a[href], [role="link"]');
|
|
19
|
+
const accessibleNames = new Array();
|
|
20
|
+
const hrefList = new Array();
|
|
21
|
+
const applicableLinks = new Array();
|
|
22
|
+
for (const link of links !== null && links !== void 0 ? links : []) {
|
|
23
|
+
let aName;
|
|
24
|
+
if (window.DomUtils.isElementADescendantOf(link, ['svg'], [])) {
|
|
25
|
+
aName = window.AccessibilityUtils.getAccessibleNameSVG(link);
|
|
26
|
+
}
|
|
27
|
+
else if (window.AccessibilityUtils.isElementInAT(link)) {
|
|
28
|
+
aName = window.AccessibilityUtils.getAccessibleName(link);
|
|
29
|
+
}
|
|
30
|
+
const href = link.getElementAttribute('href');
|
|
31
|
+
if (aName) {
|
|
32
|
+
hrefList.push(href);
|
|
33
|
+
accessibleNames.push(aName);
|
|
34
|
+
applicableLinks.push(link);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
let counter = 0;
|
|
38
|
+
const blacklist = new Array();
|
|
39
|
+
for (const accessibleName of accessibleNames !== null && accessibleNames !== void 0 ? accessibleNames : []) {
|
|
40
|
+
const elementList = new Array();
|
|
41
|
+
if (blacklist.indexOf(counter) < 0 && accessibleName && accessibleName !== '') {
|
|
42
|
+
const hasEqualAn = this.isInListExceptIndex(accessibleName, accessibleNames, counter);
|
|
43
|
+
if (hasEqualAn.length > 0) {
|
|
44
|
+
blacklist.push(...hasEqualAn);
|
|
45
|
+
let hasEqualHref = true;
|
|
46
|
+
for (const index of hasEqualAn) {
|
|
47
|
+
hasEqualHref = hrefList[index] === hrefList[counter] && hrefList[counter] !== null;
|
|
48
|
+
elementList.push(applicableLinks[index]);
|
|
49
|
+
}
|
|
50
|
+
elementList.push(applicableLinks[counter]);
|
|
51
|
+
hasEqualAn.push(counter);
|
|
52
|
+
const test = new evaluation_1.Test();
|
|
53
|
+
if (hasEqualHref) {
|
|
54
|
+
test.verdict = evaluation_1.Verdict.PASSED;
|
|
55
|
+
test.resultCode = 'P1';
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
test.verdict = evaluation_1.Verdict.WARNING;
|
|
59
|
+
test.resultCode = 'F1';
|
|
60
|
+
}
|
|
61
|
+
test.addElements(elementList, true, false, true);
|
|
62
|
+
this.addTestResult(test);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
counter++;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
isInListExceptIndex(accessibleName, accessibleNames, index) {
|
|
69
|
+
const result = new Array();
|
|
70
|
+
let counter = 0;
|
|
71
|
+
for (const accessibleNameToCompare of accessibleNames !== null && accessibleNames !== void 0 ? accessibleNames : []) {
|
|
72
|
+
if (accessibleNameToCompare === accessibleName && counter !== index) {
|
|
73
|
+
result.push(counter);
|
|
74
|
+
}
|
|
75
|
+
counter++;
|
|
76
|
+
}
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
exports.QW_ACT_R9 = QW_ACT_R9;
|
|
81
|
+
__decorate([
|
|
82
|
+
applicability_1.ElementExists,
|
|
83
|
+
applicability_1.IsInMainContext,
|
|
84
|
+
__metadata("design:type", Function),
|
|
85
|
+
__metadata("design:paramtypes", []),
|
|
86
|
+
__metadata("design:returntype", void 0)
|
|
87
|
+
], QW_ACT_R9.prototype, "execute", null);
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export * from './QW-ACT-R1';
|
|
2
|
+
export * from './QW-ACT-R10';
|
|
3
|
+
export * from './QW-ACT-R11';
|
|
4
|
+
export * from './QW-ACT-R12';
|
|
5
|
+
export * from './QW-ACT-R13';
|
|
6
|
+
export * from './QW-ACT-R14';
|
|
7
|
+
export * from './QW-ACT-R15';
|
|
8
|
+
export * from './QW-ACT-R16';
|
|
9
|
+
export * from './QW-ACT-R17';
|
|
10
|
+
export * from './QW-ACT-R19';
|
|
11
|
+
export * from './QW-ACT-R2';
|
|
12
|
+
export * from './QW-ACT-R20';
|
|
13
|
+
export * from './QW-ACT-R21';
|
|
14
|
+
export * from './QW-ACT-R22';
|
|
15
|
+
export * from './QW-ACT-R23';
|
|
16
|
+
export * from './QW-ACT-R24';
|
|
17
|
+
export * from './QW-ACT-R25';
|
|
18
|
+
export * from './QW-ACT-R26';
|
|
19
|
+
export * from './QW-ACT-R27';
|
|
20
|
+
export * from './QW-ACT-R28';
|
|
21
|
+
export * from './QW-ACT-R29';
|
|
22
|
+
export * from './QW-ACT-R30';
|
|
23
|
+
export * from './QW-ACT-R31';
|
|
24
|
+
export * from './QW-ACT-R32';
|
|
25
|
+
export * from './QW-ACT-R33';
|
|
26
|
+
export * from './QW-ACT-R34';
|
|
27
|
+
export * from './QW-ACT-R35';
|
|
28
|
+
export * from './QW-ACT-R36';
|
|
29
|
+
export * from './QW-ACT-R37';
|
|
30
|
+
export * from './QW-ACT-R38';
|
|
31
|
+
export * from './QW-ACT-R39';
|
|
32
|
+
export * from './QW-ACT-R4';
|
|
33
|
+
export * from './QW-ACT-R40';
|
|
34
|
+
export * from './QW-ACT-R41';
|
|
35
|
+
export * from './QW-ACT-R42';
|
|
36
|
+
export * from './QW-ACT-R43';
|
|
37
|
+
export * from './QW-ACT-R44';
|
|
38
|
+
export * from './QW-ACT-R48';
|
|
39
|
+
export * from './QW-ACT-R49';
|
|
40
|
+
export * from './QW-ACT-R5';
|
|
41
|
+
export * from './QW-ACT-R50';
|
|
42
|
+
export * from './QW-ACT-R51';
|
|
43
|
+
export * from './QW-ACT-R53';
|
|
44
|
+
export * from './QW-ACT-R54';
|
|
45
|
+
export * from './QW-ACT-R55';
|
|
46
|
+
export * from './QW-ACT-R56';
|
|
47
|
+
export * from './QW-ACT-R58';
|
|
48
|
+
export * from './QW-ACT-R59';
|
|
49
|
+
export * from './QW-ACT-R6';
|
|
50
|
+
export * from './QW-ACT-R60';
|
|
51
|
+
export * from './QW-ACT-R61';
|
|
52
|
+
export * from './QW-ACT-R62';
|
|
53
|
+
export * from './QW-ACT-R63';
|
|
54
|
+
export * from './QW-ACT-R64';
|
|
55
|
+
export * from './QW-ACT-R65';
|
|
56
|
+
export * from './QW-ACT-R66';
|
|
57
|
+
export * from './QW-ACT-R67';
|
|
58
|
+
export * from './QW-ACT-R68';
|
|
59
|
+
export * from './QW-ACT-R69';
|
|
60
|
+
export * from './QW-ACT-R7';
|
|
61
|
+
export * from './QW-ACT-R70';
|
|
62
|
+
export * from './QW-ACT-R71';
|
|
63
|
+
export * from './QW-ACT-R73';
|
|
64
|
+
export * from './QW-ACT-R74';
|
|
65
|
+
export * from './QW-ACT-R75';
|
|
66
|
+
export * from './QW-ACT-R76';
|
|
67
|
+
export * from './QW-ACT-R77';
|
|
68
|
+
export * from './QW-ACT-R9';
|
|
69
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rules/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC"}
|