accessibility-checker 3.1.0 → 3.1.4

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 (54) hide show
  1. package/README.md +3 -2
  2. package/bin/achecker.d.ts +2 -0
  3. package/bin/achecker.js +293 -177
  4. package/bin/achecker.js.map +1 -0
  5. package/index.d.ts +317 -0
  6. package/index.js +359 -13
  7. package/index.js.map +1 -0
  8. package/lib/ACBrowserManager.d.ts +22 -0
  9. package/lib/ACBrowserManager.js +237 -0
  10. package/lib/ACBrowserManager.js.map +1 -0
  11. package/lib/ACConfigManager.d.ts +6 -0
  12. package/lib/ACConfigManager.js +399 -0
  13. package/lib/ACConfigManager.js.map +1 -0
  14. package/lib/ACConstants.d.ts +17 -0
  15. package/lib/ACConstants.js +12 -38
  16. package/lib/ACConstants.js.map +1 -0
  17. package/lib/ACEngineManager.d.ts +21 -0
  18. package/lib/ACEngineManager.js +220 -0
  19. package/lib/ACEngineManager.js.map +1 -0
  20. package/lib/ACHelper.d.ts +2 -0
  21. package/lib/ACHelper.js +485 -2085
  22. package/lib/ACHelper.js.map +1 -0
  23. package/lib/ACReportManager.d.ts +586 -0
  24. package/lib/ACReportManager.js +1150 -0
  25. package/lib/ACReportManager.js.map +1 -0
  26. package/lib/api/IChecker.d.ts +131 -0
  27. package/lib/api/IChecker.js +11 -0
  28. package/lib/api/IChecker.js.map +1 -0
  29. package/lib/api/IEngine.d.ts +124 -0
  30. package/lib/api/IEngine.js +110 -0
  31. package/lib/api/IEngine.js.map +1 -0
  32. package/lib/api/IMapper.d.ts +37 -0
  33. package/lib/api/IMapper.js +18 -0
  34. package/lib/api/IMapper.js.map +1 -0
  35. package/lib/log/ACMetricsLogger.d.ts +67 -0
  36. package/lib/log/ACMetricsLogger.js +40 -66
  37. package/lib/log/ACMetricsLogger.js.map +1 -0
  38. package/lib/reporters/ACReporterCSV.d.ts +103 -0
  39. package/lib/reporters/ACReporterCSV.js +83 -152
  40. package/lib/reporters/ACReporterCSV.js.map +1 -0
  41. package/lib/reporters/ACReporterHTML.d.ts +114 -0
  42. package/lib/reporters/ACReporterHTML.js +150 -293
  43. package/lib/reporters/ACReporterHTML.js.map +1 -0
  44. package/lib/reporters/ACReporterJSON.d.ts +114 -0
  45. package/lib/reporters/ACReporterJSON.js +95 -249
  46. package/lib/reporters/ACReporterJSON.js.map +1 -0
  47. package/lib/reporters/ReportUtil.d.ts +33 -0
  48. package/lib/reporters/ReportUtil.js +65 -0
  49. package/lib/reporters/ReportUtil.js.map +1 -0
  50. package/lib/reporters/genReport.d.ts +1 -0
  51. package/lib/reporters/genReport.js +13 -11
  52. package/lib/reporters/genReport.js.map +1 -0
  53. package/package.json +4 -3
  54. package/lib/ACConfigLoader.js +0 -358
package/index.d.ts ADDED
@@ -0,0 +1,317 @@
1
+ /******************************************************************************
2
+ Copyright:: 2020- IBM, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ *****************************************************************************/
16
+ import { eAssertResult, ICheckerError, ICheckerReport, ICheckerResult, IConfig, IConfigUnsupported } from "./lib/api/IChecker";
17
+ /**
18
+ * This function is responsible performing a scan based on the context that is provided, following are
19
+ * the supported context type:
20
+ * Single node (HTMLElement)
21
+ * Local file path (String)
22
+ * URL (String)
23
+ * document node
24
+ * data stream for html content (String)
25
+ *
26
+ * Future Items
27
+ * Multiple node (Array of HTMLElements) ---> FUTURE
28
+ *
29
+ * @param {(String|HTMLElement|DocumentNode|Puppeteer Page |)} content - Provide the context to scan, which includes the items from above.
30
+ * @param {String} label - Provide a label for the scan that is being performed
31
+ * @param {Function} callback - (optional) Provide callback function which will be executed once the results are extracted.
32
+ * @return Promise with the ICheckerResult
33
+ */
34
+ export declare function getCompliance(content: any, label: string, callback?: (report: ICheckerReport | ICheckerError, webdriver: any) => void): Promise<ICheckerResult>;
35
+ /**
36
+ * This function is responsible for comparing the scan results with baseline or checking that there are
37
+ * no violations which fall into the failsLevels levels. In the case a baseline is found then baseline will
38
+ * be used to perform the check, in the case no baseline is provided then we comply with only failing if
39
+ * there is a sinble violation which falls into failLevels.
40
+ *
41
+ * @param {ICheckerReport} actual - the actual results object provided by the user, this object should follow the
42
+ * same format as outlined in the return of aChecker.buildReport function.
43
+ *
44
+ * @return {int} - return 0 in the case actual matches baseline or no violations fall into failsLevels,
45
+ * return 1 in the case actual results does not match baseline results,
46
+ * return 2 in the case that there is a failure based on failLevels (this means no baseline found).
47
+ * return -1 in the case that there is an exception that occured in the results object which came from the scan engine.
48
+ */
49
+ export declare function assertCompliance(report: ICheckerReport): eAssertResult;
50
+ /**
51
+ * This function is responsible for printing the scan results to console.
52
+ *
53
+ * @param {Object} results - Provide the results from the scan.
54
+ *
55
+ * @return {String} resultsString - String representation of the results/violations.
56
+ *
57
+ * PUBLIC API
58
+ *
59
+ * @memberOf this
60
+ */
61
+ export declare function stringifyResults(report: ICheckerReport): string;
62
+ export declare function getConfig(): Promise<IConfig>;
63
+ export declare function getConfigUnsupported(): Promise<IConfigUnsupported>;
64
+ export declare function close(): Promise<void>;
65
+ /**
66
+ * This function is responsible for getting the diff results based on label for a scan that was already performed.
67
+ *
68
+ * @param {String} label - Provide a lable for which to get the diff results for.
69
+ *
70
+ * @return {Object} - return the diff results object from global space based on label provided, the object will be
71
+ * in the same format as outlined in the return of aChecker.diffResultsWithExpected function.
72
+ */
73
+ export declare function getDiffResults(label: string): any;
74
+ /**
75
+ * This function is responsible for getting the baseline object for a label that was provided.
76
+ *
77
+ * @param {String} label - Provide a lable for which to get the baseline for.
78
+ *
79
+ * @return {Object} - return the baseline object from global space based on label provided, the object will be
80
+ * in the same format as outlined in the return of aChecker.buildReport function.
81
+ */
82
+ export declare function getBaseline(label: string): any;
83
+ /**
84
+ * This function is responsible for comparing actual with expected and returning all the differences as an array.
85
+ *
86
+ * @param {Object} actual - Provide the actual object to be used for compare
87
+ * @param {Object} expected - Provide the expected object to be used for compare
88
+ * @param {boolean} clean - Provide a boolean if both the actual and expected objects need to be cleaned
89
+ * cleaning refers to converting the objects to match with a basic compliance
90
+ * compare of xpath and ruleId.
91
+ *
92
+ * @return {Object} differences - return an array of diff objects that were found, following is the format of the object:
93
+ * [
94
+ * {
95
+ * "kind": "E",
96
+ * "path": [
97
+ * "reports",
98
+ * 0,
99
+ * "issues",
100
+ * 10,
101
+ * "xpath"
102
+ * ],
103
+ * "lhs": "/html[1]/body[1]/div[2]/table[5]",
104
+ * "rhs": "/html[1]/body[1]/div[2]/table[5]d",
105
+ * },
106
+ * {
107
+ * "kind": "E",
108
+ * "path": [
109
+ * "label"
110
+ * ],
111
+ * "lhs": "Table-layoutMultiple",
112
+ * "rhs": "dependencies/tools-rules-html/v2/a11y/test/g471/Table-layoutMultiple.html",
113
+ * }
114
+ * ]
115
+ */
116
+ export declare function diffResultsWithExpected(actual: any, expected: any, clean: any): any;
117
+ /**
118
+ * This function is responsible for cleaning up the compliance baseline or actual results, based on
119
+ * a pre-defined set of criterias, such as the following:
120
+ * 1. No need to compare summary object
121
+ * 2. Only need to compare the ruleId and xpath in for each of the issues
122
+ *
123
+ * @param {Object} objectToClean - Provide either an baseline or actual results object which would be in the
124
+ * the same format as outlined in the return of aChecker.buildReport function.
125
+ *
126
+ * @return {Object} objectToClean - return an object that was cleaned to only contain the information that is
127
+ * needed for compare. Following is a sample of how the cleaned object will look like:
128
+ * {
129
+ * "label": "unitTestContent",
130
+ * "reports": [
131
+ * {
132
+ * "frameIdx": "0",
133
+ * "frameTitle": "Frame 0",
134
+ * "issues": [
135
+ * {
136
+ * "ruleId": "1",
137
+ * "xpath": "/html[1]/head[1]/style[1]"
138
+ * }
139
+ * ....
140
+ * ]
141
+ * },
142
+ * {
143
+ * "frameIdx": "1",
144
+ * "frameTitle": "Frame 1",
145
+ * "issues": [
146
+ * {
147
+ * "ruleId": "471",
148
+ * "xpath": "/html[1]/body[1]/div[2]/table[3]"
149
+ * }
150
+ * ....
151
+ * ]
152
+ * }
153
+ * ]
154
+ * }
155
+ */
156
+ export declare function cleanComplianceObjectBeforeCompare(objectToClean: any): any;
157
+ export declare const ruleIdToLegacyId: {
158
+ RPT_List_Misuse: string;
159
+ RPT_Marquee_Trigger: string;
160
+ RPT_Headers_FewWords: string;
161
+ WCAG20_Input_ExplicitLabelImage: string;
162
+ RPT_Img_UsemapValid: string;
163
+ WCAG20_Object_HasText: string;
164
+ WCAG20_Applet_HasAlt: string;
165
+ RPT_Media_AudioTrigger: string;
166
+ RPT_Blockquote_HasCite: string;
167
+ RPT_Meta_Refresh: string;
168
+ WCAG20_Frame_HasTitle: string;
169
+ WCAG20_Input_ExplicitLabel: string;
170
+ RPT_Media_AltBrief: string;
171
+ WCAG20_A_TargetAndText: string;
172
+ WCAG20_Area_HasAlt: string;
173
+ RPT_Media_ImgColorUsage: string;
174
+ WCAG20_Meta_RedirectZero: string;
175
+ RPT_Elem_Deprecated: string;
176
+ RPT_Blockquote_WrapsTextQuote: string;
177
+ RPT_Elem_EventMouseAndKey: string;
178
+ WCAG20_Doc_HasTitle: string;
179
+ RPT_Block_ShouldBeHeading: string;
180
+ WCAG20_Form_HasSubmit: string;
181
+ RPT_Elem_UniqueId: string;
182
+ RPT_Font_ColorInForm: string;
183
+ RPT_Label_UniqueFor: string;
184
+ RPT_Img_AltCommonMisuse: string;
185
+ RPT_Img_LongDescription2: string;
186
+ WCAG20_Img_HasAlt: string;
187
+ RPT_Style_BackgroundImage: string;
188
+ RPT_Pre_ASCIIArt: string;
189
+ RPT_Media_VideoReferenceTrigger: string;
190
+ RPT_Media_AudioVideoAltFilename: string;
191
+ RPT_Style_ColorSemantics1: string;
192
+ WCAG20_Select_HasOptGroup: string;
193
+ RPT_List_UseMarkup: string;
194
+ RPT_Script_OnclickHTML1: string;
195
+ WCAG20_Table_Structure: string;
196
+ WCAG20_Img_AltTriggerNonDecorative: string;
197
+ WCAG20_Blink_AlwaysTrigger: string;
198
+ RPT_Blink_CSSTrigger1: string;
199
+ RPT_Html_SkipNav: string;
200
+ RPT_Title_Valid: string;
201
+ RPT_Header_HasContent: string;
202
+ WCAG20_Html_HasLang: string;
203
+ WCAG20_Form_TargetAndText: string;
204
+ WCAG20_A_HasText: string;
205
+ WCAG20_Fieldset_HasLegend: string;
206
+ RPT_Media_VideoObjectTrigger: string;
207
+ RPT_Text_SensoryReference: string;
208
+ RPT_Embed_AutoStart: string;
209
+ RPT_Style_HinderFocus1: string;
210
+ WCAG20_Elem_Lang_Valid: string;
211
+ WCAG20_Img_LinkTextNotRedundant: string;
212
+ RPT_Style_ExternalStyleSheet: string;
213
+ RPT_Header_Trigger: string;
214
+ RPT_Script_OnclickHTML2: string;
215
+ WCAG20_Table_CapSummRedundant: string;
216
+ WCAG20_Input_LabelBefore: string;
217
+ WCAG20_Input_LabelAfter: string;
218
+ WCAG20_Embed_HasNoEmbed: string;
219
+ WCAG20_Table_Scope_Valid: string;
220
+ WCAG20_Img_TitleEmptyWhenAltNull: string;
221
+ WCAG20_Input_InFieldSet: string;
222
+ WCAG20_Input_RadioChkInFieldSet: string;
223
+ WCAG20_Select_NoChangeAction: string;
224
+ WCAG20_Input_HasOnchange: string;
225
+ RPT_Embed_HasAlt: string;
226
+ Valerie_Noembed_HasContent: string;
227
+ Valerie_Caption_HasContent: string;
228
+ Valerie_Caption_InTable: string;
229
+ Valerie_Label_HasContent: string;
230
+ Valerie_Elem_DirValid: string;
231
+ Valerie_Frame_SrcHtml: string;
232
+ Valerie_Table_DataCellRelationships: string;
233
+ RPT_Table_LayoutTrigger: string;
234
+ RPT_Table_DataHeadingsAria: string;
235
+ WCAG20_Label_RefValid: string;
236
+ WCAG20_Elem_UniqueAccessKey: string;
237
+ WCAG20_Script_FocusBlurs: string;
238
+ HAAC_Img_UsemapAlt: string;
239
+ WCAG20_Text_Emoticons: string;
240
+ WCAG20_Style_BeforeAfter: string;
241
+ WCAG20_Text_LetterSpacing: string;
242
+ Rpt_Aria_ValidRole: string;
243
+ Rpt_Aria_ValidPropertyValue: string;
244
+ Rpt_Aria_ValidIdRef: string;
245
+ Rpt_Aria_RequiredProperties: string;
246
+ Rpt_Aria_EmptyPropertyValue: string;
247
+ Rpt_Aria_ValidProperty: string;
248
+ Rpt_Aria_InvalidTabindexForActivedescendant: string;
249
+ Rpt_Aria_MissingFocusableChild: string;
250
+ Rpt_Aria_MissingKeyboardHandler: string;
251
+ WCAG20_Img_PresentationImgHasNonNullAlt: string;
252
+ Rpt_Aria_MultipleSearchLandmarks: string;
253
+ Rpt_Aria_MultipleApplicationLandmarks: string;
254
+ Rpt_Aria_ApplicationLandmarkLabel: string;
255
+ Rpt_Aria_MultipleDocumentRoles: string;
256
+ WCAG20_Label_TargetInvisible: string;
257
+ HAAC_Video_HasNoTrack: string;
258
+ HAAC_Audio_Video_Trigger: string;
259
+ HAAC_Input_HasRequired: string;
260
+ HAAC_Aria_ImgAlt: string;
261
+ HAAC_BackgroundImg_HasTextOrTitle: string;
262
+ HAAC_Accesskey_NeedLabel: string;
263
+ HAAC_Aria_Or_HTML5_Attr: string;
264
+ HAAC_Canvas: string;
265
+ HAAC_Figure_label: string;
266
+ HAAC_Input_Placeholder: string;
267
+ HAAC_Aria_Native_Host_Sematics: string;
268
+ RPT_Form_ChangeEmpty: string;
269
+ IBMA_Color_Contrast_WCAG2AA: string;
270
+ IBMA_Color_Contrast_WCAG2AA_PV: string;
271
+ WCAG20_Body_FirstASkips_Native_Host_Sematics: string;
272
+ WCAG20_Body_FirstAContainsSkipText_Native_Host_Sematics: string;
273
+ Rpt_Aria_RequiredChildren_Native_Host_Sematics: string;
274
+ Rpt_Aria_RequiredParent_Native_Host_Sematics: string;
275
+ Rpt_Aria_EventHandlerMissingRole_Native_Host_Sematics: string;
276
+ Rpt_Aria_WidgetLabels_Implicit: string;
277
+ Rpt_Aria_OrphanedContent_Native_Host_Sematics: string;
278
+ Rpt_Aria_RegionLabel_Implicit: string;
279
+ Rpt_Aria_MultipleMainsVisibleLabel_Implicit: string;
280
+ Rpt_Aria_MultipleBannerLandmarks_Implicit: string;
281
+ Rpt_Aria_MultipleComplementaryLandmarks_Implicit: string;
282
+ Rpt_Aria_MultipleContentinfoLandmarks_Implicit: string;
283
+ Rpt_Aria_MultipleFormLandmarks_Implicit: string;
284
+ Rpt_Aria_MultipleNavigationLandmarks_Implicit: string;
285
+ Rpt_Aria_ComplementaryLandmarkLabel_Implicit: string;
286
+ Rpt_Aria_MultipleArticleRoles_Implicit: string;
287
+ Rpt_Aria_ArticleRoleLabel_Implicit: string;
288
+ Rpt_Aria_MultipleGroupRoles_Implicit: string;
289
+ Rpt_Aria_GroupRoleLabel_Implicit: string;
290
+ Rpt_Aria_MultipleContentinfoInSiblingSet_Implicit: string;
291
+ Rpt_Aria_OneBannerInSiblingSet_Implicit: string;
292
+ Rpt_Aria_ContentinfoWithNoMain_Implicit: string;
293
+ Rpt_Aria_ComplementaryRequiredLabel_Implicit: string;
294
+ Rpt_Aria_MultipleRegionsUniqueLabel_Implicit: string;
295
+ IBMA_Focus_Tabbable: string;
296
+ IBMA_Focus_MultiTab: string;
297
+ WCAG20_Table_SummaryAria3: string;
298
+ RPT_Style_Trigger2: string;
299
+ Rpt_Aria_MultipleMainsRequireLabel_Implicit_2: string;
300
+ HAAC_Media_DocumentTrigger2: string;
301
+ HAAC_Aria_ErrorMessage: string;
302
+ HAAC_List_Group_ListItem: string;
303
+ HAAC_ActiveDescendantCheck: string;
304
+ HAAC_Application_Role_Text: string;
305
+ Rpt_Aria_MultipleToolbarUniqueLabel: string;
306
+ HAAC_Combobox_ARIA_11_Guideline: string;
307
+ HAAC_Combobox_Must_Have_Text_Input: string;
308
+ HAAC_Combobox_DOM_Focus: string;
309
+ HAAC_Combobox_Autocomplete: string;
310
+ HAAC_Combobox_Autocomplete_Invalid: string;
311
+ HAAC_Combobox_Expanded: string;
312
+ HAAC_Combobox_Popup: string;
313
+ WCAG21_Style_Viewport: string;
314
+ WCAG21_Label_Accessible: string;
315
+ WCAG21_Input_Autocomplete: string;
316
+ WCAG20_Input_VisibleLabel: string;
317
+ };