Skip to content

Commit 1196bb3

Browse files
authored
docs: Update rule-development.md
Spotted this was a little out of date
1 parent 9a743ee commit 1196bb3

File tree

1 file changed

+21
-16
lines changed

1 file changed

+21
-16
lines changed

doc/rule-development.md

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Before you start writing axe-core rules, be sure to create a proposal for them in a GitHub issue. Read [Proposing Axe-core rules](./rule-proposal.md) for details.
44

5-
A rule is a JSON Object that defines a test for axe-core to run. At a high level, think of a rule as doing two things. First it finds all elements that it should test, and after that it runs a number of checks to see if those selected elements pass or fail the rule.
5+
A rule is a JSON Object that defines a test for axe-core to run. At a high level, think of a rule as doing two things. First it finds all elements that it should test, and after that it runs a number of checks to see if those selected elements pass or fail the rule. The code for rules is in the [`lib/rules`](../lib/rules/) and the checks in [`lib/checks`](../lib/checks/).
66

77
## Rule Select and Matches
88

@@ -20,20 +20,22 @@ The actual testing of elements in axe-core is done by checks. A rule has one or
2020

2121
## Rule Properties
2222

23-
| Prop. Name | Description |
24-
| -------------------- | ------------------------------------------------------------------- |
25-
| id | Unique identifier for the rule |
26-
| selector | CSS Selector that matches elements to test |
27-
| matches | Function to further filter the outcome of the selector |
28-
| excludeHidden | Should hidden elements be excluded |
29-
| all | Checks that must all return true |
30-
| any | Checks of which at least one must return true |
31-
| none | Checks that must all return false |
32-
| pageLevel | Should the rule only run on the main window |
33-
| enabled | Does the rule run by default |
34-
| tags | Grouping for the rule, such as wcag2a, best-practice |
35-
| metadata.description | Description of what a rule does |
36-
| metadata.help | Short description of a violation, used in the axe extension sidebar |
23+
| Prop. Name | Description |
24+
| -------------------- | ---------------------------------------------------------------------------- |
25+
| id | Unique identifier for the rule |
26+
| selector | CSS Selector that matches elements to test |
27+
| matches | Function to further filter the outcome of the selector |
28+
| excludeHidden | Should hidden elements be excluded (default: true) |
29+
| reviewOnFail | Whether any fail on the rule should be reported as needs review / incomplete |
30+
| impact | "minor", "serious", "critical" |
31+
| all | Checks that must all return true |
32+
| any | Checks of which at least one must return true |
33+
| none | Checks that must all return false |
34+
| pageLevel | Should the rule only run on the main window |
35+
| enabled | Does the rule run by default |
36+
| tags | Grouping for the rule, such as wcag2a, best-practice |
37+
| metadata.description | Description of what a rule does |
38+
| metadata.help | Short description of a violation, used in the axe extension sidebar |
3739

3840
## Check Properties
3941

@@ -43,7 +45,6 @@ The actual testing of elements in axe-core is done by checks. A rule has one or
4345
| evaluate | Evaluating function, returning a boolean value |
4446
| options | Configurable value for the check |
4547
| after | Cleanup function, run after check is done |
46-
| metadata.impact | "minor", "serious", "critical" |
4748
| metadata.messages.pass | Describes why the check passed |
4849
| metadata.messages.fail | Describes why the check failed |
4950
| metadata.messages.incomplete | Describes why the check didn’t complete |
@@ -121,3 +122,7 @@ Rules of thumb for determining whether an `after` function is required - if any
121122
2. Does the rule evaluate hierarchy of things across a whole page?
122123

123124
Rules that use an `after` function MUST have iframe test cases that assert correct data passing between iframes and handle all the relevant cases across iframes.
125+
126+
## rule generation
127+
128+
Axe comes with a script to help generate rule files. To use this, call `npm run rule-gem` from the root of the project. If you haven't already, make sure to call `npm install` before to get all dependencies installed first.

0 commit comments

Comments
 (0)