forked from qualweb/types
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevaluation.d.ts
103 lines (94 loc) · 3.1 KB
/
evaluation.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
declare module "@qualweb/evaluation" {
import {
QualwebOptions,
EvaluationReport,
Evaluator,
Execute,
Modules,
Module,
Url,
} from "@qualweb/core";
import { Report } from "@qualweb/earl-reporter";
import { ACTRulesReport, ACTRules, ACTROptions } from "@qualweb/act-rules";
import {
WCAGTechniquesReport,
WCAGOptions,
WCAGTechniques,
} from "@qualweb/wcag-techniques";
import { BestPracticesReport, BPOptions } from "@qualweb/best-practices";
import { WappalyzerReport } from "@qualweb/wappalyzer";
import { CounterReport, executeCounter } from "@qualweb/counter";
import { HTMLValidationReport } from "@qualweb/html-validator";
import { QWPage } from "@qualweb/qw-page";
import { QWElement } from "@qualweb/qw-element";
import { DomUtils, AccessibilityUtils } from "@qualweb/util";
import { Page } from "puppeteer";
type Level = "A" | "AA" | "AAA";
type Principle = "Perceivable" | "Operable" | "Understandable" | "Robust";
global {
interface Window {
qwPage: QWPage;
qwElement: QWElement;
act: ACTRules;
wcag: WCAGTechniques;
executeCounter: typeof executeCounter;
DomUtils: typeof DomUtils;
AccessibilityUtils: typeof AccessibilityUtils;
disabledWidgets: Array<QWElement>;
}
}
class Metadata {
private passed: number;
private warning: number;
private failed: number;
private inapplicable: number;
public addPassedResults(results: number): void;
public addWarningResults(results: number): void;
public addFailedResults(results: number): void;
public addInapplicableResults(results: number): void;
public getResults(): {
passed: number;
failed: number;
warning: number;
inapplicable: number;
};
}
class EvaluationRecord {
private readonly type: "evaluation";
private readonly evaluator: Evaluator;
private readonly metadata: Metadata;
private readonly modules: Modules;
constructor(evaluator: Evaluator);
public addModuleEvaluation(
module: Module,
evaluation: Report | WappalyzerReport | CounterReport
): void;
public getFinalReport(): EvaluationReport;
}
class Evaluation {
private readonly url: string;
private readonly page: Page;
private readonly execute: Execute;
constructor(url: string, page: Page, execute: Execute);
public evaluatePage(
sourceHtml: string,
options: QualwebOptions,
validation?: HTMLValidationReport
): Promise<EvaluationRecord>;
private getEvaluator(): Promise<Evaluator>;
private parseUrl(): Url;
private init(): Promise<void>;
private executeACT(
sourceHtml: string,
options?: ACTROptions
): Promise<ACTRulesReport>;
private executeWCAG(
validation?: HTMLValidationReport,
options?: WCAGOptions
): Promise<WCAGTechniquesReport>;
private executeBP(options?: BPOptions): Promise<BestPracticesReport>;
private executeCounter(): Promise<CounterReport>;
private detectIfUnwantedTabWasOpened(): Promise<boolean>;
}
export { Level, Principle, Evaluation, EvaluationRecord, Metadata };
}