-
Notifications
You must be signed in to change notification settings - Fork 3
/
3_3_2_LabelsOrInstructions(A).js
executable file
·92 lines (86 loc) · 3.71 KB
/
3_3_2_LabelsOrInstructions(A).js
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
setTimeout(() => {
LabelsOrInstructions()
}, 20000);
function LabelsOrInstructions() {
$.fn.log = function () {
console.log.apply(console, this);
return this;
};
var inputTags = document.querySelectorAll('input')
for (var d = 0; d < inputTags.length; d++) {
var testCasePass = false
var labelTags = document.querySelectorAll('input');
for (var x = 0; x < labelTags.length; x++) {
if (labelTags[x].htmlFor == inputTags[d].id) {
if (labelTags[x].innerText != null && labelTags[x].innerText != "") {
testCasePass = true
break
}
}
if (testCasePass == false) {
console.log("%cRule:%cWCAG 3.3.2 (2.0,A)",
`color: #FFF;
background-color: #333;
border-radius: 5px 0px 0px 5px;
padding: 5px 10px;
font-size: 0.8rem;
display: inline;
box-shadow: 0 0 25px rgba(0, 0, 0, 0.05);`,
`color: #FFF;
display: inline;
font-size: 0.8rem;
background-color: #809FFF;
border-radius: 0px 5px 5px 0px;
padding: 5px 10px;
box-shadow: 0 0 25px rgba(0, 0, 0, 0.05);`)
console.log("%cError:%cInput element's corresponding label's text found empty",
`color: #FFF;
background-color: #333;
border-radius: 5px 0px 0px 5px;
padding: 5px 10px;
font-size: 0.8rem;
display: inline;
box-shadow: 0 0 25px rgba(0, 0, 0, 0.05);`,
`color: #FFF;
display: inline;
font-size: 0.8rem;
background-color: #EB5177;
border-radius: 0px 5px 5px 0px;
padding: 5px 10px;
box-shadow: 0 0 25px rgba(0, 0, 0, 0.05);`)
console.log("%cCode Snippet:",
`color: #FFF;
background-color: #333;
border-radius: 5px;
padding: 5px 10px;
font-size: 0.8rem;
display: inline;
box-shadow: 0 0 25px rgba(0, 0, 0, 0.05);`)
$(inputTags[d]).log()
console.log("%cFix:%cInput element's corresponding label's text has to be added",
`color: #FFF;
background-color: #333;
border-radius: 5px 0px 0px 5px;
padding: 5px 10px;
font-size: 0.8rem;
display: inline;
box-shadow: 0 0 25px rgba(0, 0, 0, 0.05);`,
`color: #FFF;
display: inline;
font-size: 0.8rem;
background-color: #007075;
border-radius: 0px 5px 5px 0px;
padding: 5px 10px;
box-shadow: 0 0 25px rgba(0, 0, 0, 0.05);`)
console.log("%c-----------------------------------------------------------------------------",
`color: #FFF;
background-color: #293543;
font-weight: bolder;
border-radius: 5px;
padding: 5px 10px;
font-size: 1rem;
display: inline;`)
}
}
}
}