Skip to content

Commit 4d39215

Browse files
Change 'test cases' to 'examples' as required by ACT Rules Format 1.1 (#2352)
* Changes 'test cases' to 'examples' as required by ACT Rules Format 1.1 * Tests +less obvious occurrences * Fix const value typo * Update .github/PULL_REQUEST_TEMPLATE.md Co-authored-by: Kathy Eng <[email protected]> * Update .github/ISSUE_TEMPLATE/ACCESSIBILITY_SUPPORT.md Co-authored-by: Kathy Eng <[email protected]> * Update _rules/__tests__/example-has-heading.js Co-authored-by: Kathy Eng <[email protected]> * Update pages/design/rule-design.md Co-authored-by: Kathy Eng <[email protected]> * Update pages/design/rule-design.md Co-authored-by: Kathy Eng <[email protected]> * Update pages/implementations/earl-reports.md Co-authored-by: Kathy Eng <[email protected]> * Update pages/implementations/earl-reports.md Co-authored-by: Kathy Eng <[email protected]> * Update pages/implementations/examples.md Co-authored-by: Kathy Eng <[email protected]> * Update pages/implementations/examples.md Co-authored-by: Kathy Eng <[email protected]> * Update pages/implementations/mapping.md Co-authored-by: Kathy Eng <[email protected]> * Update pages/implementations/reporting.md Co-authored-by: Kathy Eng <[email protected]> * Apply suggestion from @kengdoj * More missing occurrences --------- Co-authored-by: Kathy Eng <[email protected]>
1 parent f8ace30 commit 4d39215

File tree

124 files changed

+356
-356
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+356
-356
lines changed

.github/ISSUE_TEMPLATE/ACCESSIBILITY_SUPPORT.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ assignees: ''
1414

1515
- ... List the rules here, link to its acc support section
1616

17-
## Test cases
17+
## Examples
1818

19-
### Test case 1 ...
19+
### Example 1 ...
2020

21-
(( Add test case here ))
21+
(( Add example here ))
2222

2323
```html
2424
code snippet here
2525
```
2626

27-
[Open this test case]()
27+
[Open this example]()
2828

29-
(( Add a link to a code pen or other hosted test case. Keep in mind this test case needs to be accessible and persistent. ))
29+
(( Add a link to a code pen or other hosted example. Keep in mind this example needs to be accessible and persistent. ))
3030

3131
#### Preconditions
3232

@@ -39,12 +39,12 @@ Before running the test, check your settings. In many cases default settings are
3939

4040
#### Test instructions
4141

42-
(( Provide instructions on how to test the test case, this should include: ))
42+
(( Provide instructions on how to test the example, this should include: ))
4343

4444
- Which technologies to use
4545
- Any setting changes necessary to run the test
4646
- Any variation in how to operate the different assistive technologies
47-
- Step by step instructions on how to check the test case
47+
- Step by step instructions on how to check the example
4848
- What the expected results are
4949

5050
### External links

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ Need for Call for Review:
99
<< check [Process Document on Call for Review](https://act-rules.github.io/pages/design/process/#call-for-review) >>
1010
This can be merged with 1 approval << choose reason: editorial changes to website/test code, adding new contributor, other (explain). >>
1111
This will not require a Call for Review << choose reason(s): editorial changes (including to the applicability, expectation or examples section), changes to assumptions, background, accessibility support, change to website/test code (not rule), other (explain). >>
12-
This will require a 1 week Call for Review << small changes affecting a small number of test cases, if in doubt do not use this. >>
13-
This will require a 2 weeks Call for Review << new rule, or substantial changes affecting a large number of test cases, if in doubt, use this. >>
12+
This will require a 1 week Call for Review << small changes affecting a small number of examples, if in doubt do not use this. >>
13+
This will require a 2 weeks Call for Review << new rule, or substantial changes affecting a large number of examples, if in doubt, use this. >>
1414

1515
---
1616

.github/scripts/approve-rule.mjs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ if (!argv['skip-clone']) {
2424
await createOrCheckoutBranch(config, argv.branch);
2525
await generateApprovedRulePages(config, argv.ruleId);
2626
await updateRuleVersionsYaml(config, argv.ruleId);
27-
await approveTestCaseJson(config, argv.ruleId);
27+
await approveexampleJson(config, argv.ruleId);
2828
await commitAndPush(config, `Set ${argv.ruleId} to approved`);
2929

3030
async function generateApprovedRulePages({ tmpDir, rulesDir, glossaryDir, testAssetsDir }, ruleId) {
@@ -67,17 +67,17 @@ async function updateRuleVersionsYaml({ tmpDir }, ruleId) {
6767
console.log(`Added ${ruleId} to rule-versions.yml`);
6868
}
6969

70-
async function approveTestCaseJson({ tmpDir }, ruleId) {
71-
let testCaseCount = 0;
72-
const testCaseJsonPath = `${tmpDir}content-assets/wcag-act-rules/testcases.json`;
73-
const testCaseJson = JSON.parse(fs.readFileSync(testCaseJsonPath, 'utf8'));
74-
testCaseJson.testcases.forEach((testCase, index) => {
75-
if (testCase.ruleId === ruleId) {
70+
async function approveexampleJson({ tmpDir }, ruleId) {
71+
let exampleCount = 0;
72+
const exampleJsonPath = `${tmpDir}content-assets/wcag-act-rules/examples.json`;
73+
const exampleJson = JSON.parse(fs.readFileSync(exampleJsonPath, 'utf8'));
74+
exampleJson.examples.forEach((example, index) => {
75+
if (example.ruleId === ruleId) {
7676
// Override rather than update so that `approved` isn't at the bottom
77-
testCaseJson.testcases[index] = { ruleId, approved: true, ...testCase }
78-
testCaseCount++
77+
exampleJson.examples[index] = { ruleId, approved: true, ...example }
78+
exampleCount++
7979
}
8080
});
81-
console.log(`Set ${testCaseCount} test cases of rule ${ruleId} to be approved in testcases.json`);
82-
fs.writeFileSync(testCaseJsonPath, JSON.stringify(testCaseJson, null, 2), 'utf8');
81+
console.log(`Set ${exampleCount} examples of rule ${ruleId} to be approved in examples.json`);
82+
fs.writeFileSync(exampleJsonPath, JSON.stringify(exampleJson, null, 2), 'utf8');
8383
}

.github/scripts/pr-preview.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { config, cloneWcagActRules, commitAndPush } from './commons.mjs'
44

55
await cloneWcagActRules(config);
66
await generateProposedRulePages(config);
7-
await generateTestCases(config);
7+
await generateexamples(config);
88
// const commitMessage = (await $`git log -1 --pretty=%B`).stdout;
99
// await commitAndPush(config, commitMessage);
1010

@@ -18,7 +18,7 @@ async function generateProposedRulePages({ tmpDir, rulesDir, glossaryDir, testAs
1818
`;
1919
}
2020

21-
async function generateTestCases({ tmpDir, rulesDir, testAssetsDir }) {
21+
async function generateexamples({ tmpDir, rulesDir, testAssetsDir }) {
2222
await $`node ./node_modules/act-tools/dist/cli/build-examples.js \
2323
--rulesDir "${rulesDir}" \
2424
--testAssetsDir "${testAssetsDir}" \

.github/scripts/wai-build.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { config, cloneWcagActRules, commitAndPush } from './commons.mjs'
44

55
await cloneWcagActRules(config);
66
await generateProposedRulePages(config);
7-
await generateTestCases(config);
7+
await generateexamples(config);
88
const commitMessage = (await $`git log -1 --pretty=%B`).stdout;
99
await commitAndPush(config, commitMessage);
1010

@@ -18,7 +18,7 @@ async function generateProposedRulePages({ tmpDir, rulesDir, glossaryDir, testAs
1818
`;
1919
}
2020

21-
async function generateTestCases({ tmpDir, rulesDir, testAssetsDir }) {
21+
async function generateexamples({ tmpDir, rulesDir, testAssetsDir }) {
2222
await $`node ./node_modules/act-tools/dist/cli/build-examples.js \
2323
--rulesDir "${rulesDir}" \
2424
--testAssetsDir "${testAssetsDir}" \

__deprecated__/pages/contribute/rule-feedback.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ To start giving feedback and doing reviews for draft rules:
4141

4242
We also welcome any feedback and suggestions for changes to already published rules. The published rules should be as precise as possible, limiting the number of potential false positives and false negatives. For this, it is important to draw on as many tool and methodology implementations and expert opinions as possible.
4343

44-
Feedback and corrections for existing rules can target any of the sections of the rule itself (Applicability, Expectations, Accessibility Support, etc.), as well as the test cases, for example to expand the edge case coverage.
44+
Feedback and corrections for existing rules can target any of the sections of the rule itself (Applicability, Expectations, Accessibility Support, etc.), as well as the examples, for instance to expand the edge case coverage.
4545

4646
You have several options for correcting existing rules:
4747

__tests__/spelling-ignore.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@
252252
- 4E00–9FFF
253253

254254
# JSON attributes/ metadata/ methods
255-
- testcases
255+
- examples
256256
- ruleId
257257
- ruleName
258258
- rulePage
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
const describeRule = require('../../test-utils/describe-rule')
2+
const getMarkdownAstNodesOfType = require('../../utils/get-markdown-ast-nodes-of-type')
3+
4+
describeRule('example has heading', ({ filename, markdownAST }) => {
5+
/**
6+
* get all headings of examples (eg: #### Failed Example 1)
7+
*/
8+
const exampleHeadings = getMarkdownAstNodesOfType(markdownAST, 'heading')
9+
.filter(({ depth, children }) => {
10+
return depth === 4 && children && children.length > 0
11+
})
12+
.map(({ children }) => {
13+
const [textNode] = children
14+
return textNode.value
15+
})
16+
17+
/**
18+
* get code blocks in markdown body
19+
*/
20+
const exampleCodeSnippets = getMarkdownAstNodesOfType(markdownAST, 'code')
21+
22+
/**
23+
* Check if filename has `id` as a part of the name
24+
*/
25+
test('each example has a heading', () => {
26+
const msg = `Not all examples have headings in ${filename}.`
27+
expect(exampleHeadings.length, msg).toBe(exampleCodeSnippets.length)
28+
})
29+
})
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const htmlHintRules = {
3030
'empty-tag-not-self-closed': false,
3131
}
3232

33-
describeRule('testcases', ruleData => {
33+
describeRule('examples', ruleData => {
3434
const { frontmatter, body } = ruleData
3535
const { id, name, htmlHintIgnore = [] } = frontmatter
3636

_rules/__tests__/headings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ describeRule('headings', ruleData => {
5858
/**
5959
* Check for `required` `h2` headings
6060
*/
61-
const requiredH2 = [`Applicability`, `Background`, `Test Cases`]
61+
const requiredH2 = [`Applicability`, `Background`, `Examples`]
6262
const h2Headings = getHeadingOfDepth(headings, 2)
6363
test.each(requiredH2)('has required `h2` - `%s`', heading => {
6464
expect(h2Headings).toContain(heading)

0 commit comments

Comments
 (0)