Skip to content

Commit

Permalink
update the rule message and test result for "label_ref_valid" rule #842
Browse files Browse the repository at this point in the history
  • Loading branch information
shunguoy committed Jun 11, 2024
1 parent 74f88fd commit b5d77cf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
20 changes: 10 additions & 10 deletions accessibility-checker-engine/src/v4/rules/label_ref_valid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ export let label_ref_valid: Rule = {
context: "dom:label[for]",
refactor: {
"WCAG20_Label_RefValid": {
"Pass_0": "Pass_0",
"Fail_1": "Fail_1"}
"Pass_0": "pass",
"Fail_1": "fail_invalid"}
},
help: {
"en-US": {
"Pass_0": "label_ref_valid.html",
"Fail_1": "label_ref_valid.html",
"pass": "label_ref_valid.html",
"fail_invalid": "label_ref_valid.html",
"group": "label_ref_valid.html"
}
},
messages: {
"en-US": {
"Pass_0": "Rule Passed",
"Fail_1": "The value \"{0}\" of the 'for' attribute is not the 'id' of a valid <input> element",
"group": "The 'for' attribute must reference a non-empty, unique 'id' attribute of an <input> element"
"pass": "The 'for' attribute for a label referencea a unique non-empty 'id' attribute of an <input> element",
"fail_invalid": "The value \"{0}\" of the 'for' attribute is not the 'id' of a valid <input> element",
"group": "The 'for' attribute for a label must reference a non-empty, unique 'id' attribute of an <input> element"
}
},
rulesets: [{
Expand Down Expand Up @@ -73,7 +73,7 @@ export let label_ref_valid: Rule = {
type == "hidden" || type == "search" || type == "tel" || type == "url" || type == "email" || //HTML 5
type == "date" || type == "number" || type == "range" || type == "image" || //HTML 5
type == "time" || type == "color" || // HTML 5
type == "datetime" || type == "month" || type == "week"; //HTML5.1
type == "datetime-local" || type == "month" || type == "week"; //HTML5.1
}
}

Expand All @@ -89,9 +89,9 @@ export let label_ref_valid: Rule = {
}
//return new ValidationResult(passed, [ruleContext], '', '', passed == true ? [] : [retToken]);
if (!passed) {
return RuleFail("Fail_1", retToken);
return RuleFail("fail_invalid", retToken);
} else {
return RulePass("Pass_0");
return RulePass("pass");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
"dom": "/html[1]/body[1]/main[1]/div[1]/#document-fragment[1]/div[1]/label[1]",
"aria": "/document[1]/main[1]"
},
"reasonId": "Pass_0",
"message": "Rule Passed",
"reasonId": "pass",
"message": "The 'for' attribute for a label referencea a unique non-empty 'id' attribute of an <input> element",
"messageArgs": [],
"apiArgs": [],
"category": "Accessibility"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ <h2>Switch role and input type datetime, month, week addition</h2>
<fieldset>
<input type="checkbox" role=switch name="checkbox_op2" id="checkbox_op2" value="op2" aria-checked="true">
<label for="checkbox_op2" id="label_cb">op2</label> <br>
<label for="datetime" id="label_dt">datetime </label> <input type="datetime" name="datetime" id="datetime" value="datetime"><br>
<label for="datetime" id="label_dt">datetime </label> <input type="datetime-local" name="datetime" id="datetime" value="datetime"><br>
<label for="month">month</label> <input type="month" name="month" id="month" value="month"> <br>
<label for="week">week</label> <input type="week" name="week" id="week" value="week"> <br>
</fieldset>
Expand Down

0 comments on commit b5d77cf

Please sign in to comment.