diff --git a/.github/ISSUE_TEMPLATE/ACCESSIBILITY_SUPPORT.md b/.github/ISSUE_TEMPLATE/ACCESSIBILITY_SUPPORT.md index 398f445bf9..43dd3479cc 100644 --- a/.github/ISSUE_TEMPLATE/ACCESSIBILITY_SUPPORT.md +++ b/.github/ISSUE_TEMPLATE/ACCESSIBILITY_SUPPORT.md @@ -14,19 +14,19 @@ assignees: '' - ... List the rules here, link to its acc support section -## Test cases +## Examples -### Test case 1 ... +### Example 1 ... -(( Add test case here )) +(( Add example here )) ```html code snippet here ``` -[Open this test case]() +[Open this example]() -(( Add a link to a code pen or other hosted test case. Keep in mind this test case needs to be accessible and persistent. )) +(( Add a link to a code pen or other hosted example. Keep in mind this example needs to be accessible and persistent. )) #### Preconditions @@ -39,12 +39,12 @@ Before running the test, check your settings. In many cases default settings are #### Test instructions -(( Provide instructions on how to test the test case, this should include: )) +(( Provide instructions on how to test the example, this should include: )) - Which technologies to use - Any setting changes necessary to run the test - Any variation in how to operate the different assistive technologies -- Step by step instructions on how to check the test case +- Step by step instructions on how to check the example - What the expected results are ### External links diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 8ce0f725d1..4bfbd46728 100755 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -9,8 +9,8 @@ Need for Call for Review: << check [Process Document on Call for Review](https://act-rules.github.io/pages/design/process/#call-for-review) >> This can be merged with 1 approval << choose reason: editorial changes to website/test code, adding new contributor, other (explain). >> 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). >> -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. >> -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. >> +This will require a 1 week Call for Review << small changes affecting a small number of examples, if in doubt do not use this. >> +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. >> --- diff --git a/.github/scripts/approve-rule.mjs b/.github/scripts/approve-rule.mjs index 3c74c4a2f7..f4444424d0 100644 --- a/.github/scripts/approve-rule.mjs +++ b/.github/scripts/approve-rule.mjs @@ -24,7 +24,7 @@ if (!argv['skip-clone']) { await createOrCheckoutBranch(config, argv.branch); await generateApprovedRulePages(config, argv.ruleId); await updateRuleVersionsYaml(config, argv.ruleId); -await approveTestCaseJson(config, argv.ruleId); +await approveexampleJson(config, argv.ruleId); await commitAndPush(config, `Set ${argv.ruleId} to approved`); async function generateApprovedRulePages({ tmpDir, rulesDir, glossaryDir, testAssetsDir }, ruleId) { @@ -67,17 +67,17 @@ async function updateRuleVersionsYaml({ tmpDir }, ruleId) { console.log(`Added ${ruleId} to rule-versions.yml`); } -async function approveTestCaseJson({ tmpDir }, ruleId) { - let testCaseCount = 0; - const testCaseJsonPath = `${tmpDir}content-assets/wcag-act-rules/testcases.json`; - const testCaseJson = JSON.parse(fs.readFileSync(testCaseJsonPath, 'utf8')); - testCaseJson.testcases.forEach((testCase, index) => { - if (testCase.ruleId === ruleId) { +async function approveexampleJson({ tmpDir }, ruleId) { + let exampleCount = 0; + const exampleJsonPath = `${tmpDir}content-assets/wcag-act-rules/examples.json`; + const exampleJson = JSON.parse(fs.readFileSync(exampleJsonPath, 'utf8')); + exampleJson.examples.forEach((example, index) => { + if (example.ruleId === ruleId) { // Override rather than update so that `approved` isn't at the bottom - testCaseJson.testcases[index] = { ruleId, approved: true, ...testCase } - testCaseCount++ + exampleJson.examples[index] = { ruleId, approved: true, ...example } + exampleCount++ } }); - console.log(`Set ${testCaseCount} test cases of rule ${ruleId} to be approved in testcases.json`); - fs.writeFileSync(testCaseJsonPath, JSON.stringify(testCaseJson, null, 2), 'utf8'); + console.log(`Set ${exampleCount} examples of rule ${ruleId} to be approved in examples.json`); + fs.writeFileSync(exampleJsonPath, JSON.stringify(exampleJson, null, 2), 'utf8'); } diff --git a/.github/scripts/pr-preview.mjs b/.github/scripts/pr-preview.mjs index 849e52e10f..8b9c144e68 100644 --- a/.github/scripts/pr-preview.mjs +++ b/.github/scripts/pr-preview.mjs @@ -4,7 +4,7 @@ import { config, cloneWcagActRules, commitAndPush } from './commons.mjs' await cloneWcagActRules(config); await generateProposedRulePages(config); -await generateTestCases(config); +await generateexamples(config); // const commitMessage = (await $`git log -1 --pretty=%B`).stdout; // await commitAndPush(config, commitMessage); @@ -18,7 +18,7 @@ async function generateProposedRulePages({ tmpDir, rulesDir, glossaryDir, testAs `; } -async function generateTestCases({ tmpDir, rulesDir, testAssetsDir }) { +async function generateexamples({ tmpDir, rulesDir, testAssetsDir }) { await $`node ./node_modules/act-tools/dist/cli/build-examples.js \ --rulesDir "${rulesDir}" \ --testAssetsDir "${testAssetsDir}" \ diff --git a/.github/scripts/wai-build.mjs b/.github/scripts/wai-build.mjs index b46770a6e5..5c8b18f953 100644 --- a/.github/scripts/wai-build.mjs +++ b/.github/scripts/wai-build.mjs @@ -4,7 +4,7 @@ import { config, cloneWcagActRules, commitAndPush } from './commons.mjs' await cloneWcagActRules(config); await generateProposedRulePages(config); -await generateTestCases(config); +await generateexamples(config); const commitMessage = (await $`git log -1 --pretty=%B`).stdout; await commitAndPush(config, commitMessage); @@ -18,7 +18,7 @@ async function generateProposedRulePages({ tmpDir, rulesDir, glossaryDir, testAs `; } -async function generateTestCases({ tmpDir, rulesDir, testAssetsDir }) { +async function generateexamples({ tmpDir, rulesDir, testAssetsDir }) { await $`node ./node_modules/act-tools/dist/cli/build-examples.js \ --rulesDir "${rulesDir}" \ --testAssetsDir "${testAssetsDir}" \ diff --git a/__deprecated__/pages/contribute/rule-feedback.md b/__deprecated__/pages/contribute/rule-feedback.md index f6b1fda194..f01934aeb1 100644 --- a/__deprecated__/pages/contribute/rule-feedback.md +++ b/__deprecated__/pages/contribute/rule-feedback.md @@ -41,7 +41,7 @@ To start giving feedback and doing reviews for draft rules: 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. -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. +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. You have several options for correcting existing rules: diff --git a/__tests__/spelling-ignore.yml b/__tests__/spelling-ignore.yml index 106dbb404b..230ffe9f98 100644 --- a/__tests__/spelling-ignore.yml +++ b/__tests__/spelling-ignore.yml @@ -252,7 +252,7 @@ - 4E00–9FFF # JSON attributes/ metadata/ methods -- testcases +- examples - ruleId - ruleName - rulePage diff --git a/_rules/__tests__/example-has-heading.js b/_rules/__tests__/example-has-heading.js new file mode 100644 index 0000000000..74d32004de --- /dev/null +++ b/_rules/__tests__/example-has-heading.js @@ -0,0 +1,29 @@ +const describeRule = require('../../test-utils/describe-rule') +const getMarkdownAstNodesOfType = require('../../utils/get-markdown-ast-nodes-of-type') + +describeRule('example has heading', ({ filename, markdownAST }) => { + /** + * get all headings of examples (eg: #### Failed Example 1) + */ + const exampleHeadings = getMarkdownAstNodesOfType(markdownAST, 'heading') + .filter(({ depth, children }) => { + return depth === 4 && children && children.length > 0 + }) + .map(({ children }) => { + const [textNode] = children + return textNode.value + }) + + /** + * get code blocks in markdown body + */ + const exampleCodeSnippets = getMarkdownAstNodesOfType(markdownAST, 'code') + + /** + * Check if filename has `id` as a part of the name + */ + test('each example has a heading', () => { + const msg = `Not all examples have headings in ${filename}.` + expect(exampleHeadings.length, msg).toBe(exampleCodeSnippets.length) + }) +}) diff --git a/_rules/__tests__/testcase-html-hint.js b/_rules/__tests__/example-html-hint.js similarity index 97% rename from _rules/__tests__/testcase-html-hint.js rename to _rules/__tests__/example-html-hint.js index dcc4927c2e..73380756e6 100644 --- a/_rules/__tests__/testcase-html-hint.js +++ b/_rules/__tests__/example-html-hint.js @@ -30,7 +30,7 @@ const htmlHintRules = { 'empty-tag-not-self-closed': false, } -describeRule('testcases', ruleData => { +describeRule('examples', ruleData => { const { frontmatter, body } = ruleData const { id, name, htmlHintIgnore = [] } = frontmatter diff --git a/_rules/__tests__/headings.js b/_rules/__tests__/headings.js index 4c02b35e85..ca21ec2eca 100644 --- a/_rules/__tests__/headings.js +++ b/_rules/__tests__/headings.js @@ -58,7 +58,7 @@ describeRule('headings', ruleData => { /** * Check for `required` `h2` headings */ - const requiredH2 = [`Applicability`, `Background`, `Test Cases`] + const requiredH2 = [`Applicability`, `Background`, `Examples`] const h2Headings = getHeadingOfDepth(headings, 2) test.each(requiredH2)('has required `h2` - `%s`', heading => { expect(h2Headings).toContain(heading) diff --git a/_rules/__tests__/testcase-has-heading.js b/_rules/__tests__/testcase-has-heading.js deleted file mode 100644 index d6dabdfff4..0000000000 --- a/_rules/__tests__/testcase-has-heading.js +++ /dev/null @@ -1,29 +0,0 @@ -const describeRule = require('../../test-utils/describe-rule') -const getMarkdownAstNodesOfType = require('../../utils/get-markdown-ast-nodes-of-type') - -describeRule('testcase has heading', ({ filename, markdownAST }) => { - /** - * get all headings of test case examples (eg: #### Failed Example 1) - */ - const testcaseHeadings = getMarkdownAstNodesOfType(markdownAST, 'heading') - .filter(({ depth, children }) => { - return depth === 4 && children && children.length > 0 - }) - .map(({ children }) => { - const [textNode] = children - return textNode.value - }) - - /** - * get code blocks in markdown body - */ - const testcaseCodeSnippets = getMarkdownAstNodesOfType(markdownAST, 'code') - - /** - * Check if filename has `id` as a part of the name - */ - test('each testcase has a heading', () => { - const msg = `Not all test cases have headings in ${filename}.` - expect(testcaseHeadings.length, msg).toBe(testcaseCodeSnippets.length) - }) -}) diff --git a/_rules/aria-attr-defined-5f99a7.md b/_rules/aria-attr-defined-5f99a7.md index 294257c0fc..5c3aea66de 100755 --- a/_rules/aria-attr-defined-5f99a7.md +++ b/_rules/aria-attr-defined-5f99a7.md @@ -48,7 +48,7 @@ There are no accessibility support issues known. - [Understanding Success Criterion 4.1.2: Name, Role, Value](https://www.w3.org/WAI/WCAG22/Understanding/name-role-value) - [Semantics and ARIA](https://developers.google.com/web/fundamentals/accessibility/semantics-aria/) -## Test Cases +## Examples ### Passed diff --git a/_rules/aria-hidden-no-focusable-content-6cfa84.md b/_rules/aria-hidden-no-focusable-content-6cfa84.md index 887398ba5b..5fc7298685 100755 --- a/_rules/aria-hidden-no-focusable-content-6cfa84.md +++ b/_rules/aria-hidden-no-focusable-content-6cfa84.md @@ -66,7 +66,7 @@ Some user agents treat the value of `aria-hidden` attribute as case-sensitive. - [Fourth rule of ARIA use](https://www.w3.org/TR/using-aria/#fourth) - [Element with presentational children has no focusable content](presentational-children-no-focusable-content-307n5z.md) -## Test Cases +## Examples ### Passed diff --git a/_rules/aria-required-context-role-ff89c9.md b/_rules/aria-required-context-role-ff89c9.md index a499eef039..de507f8541 100755 --- a/_rules/aria-required-context-role-ff89c9.md +++ b/_rules/aria-required-context-role-ff89c9.md @@ -46,7 +46,7 @@ This rule is restricted to direct parent-child relation in the [accessibility tr [Subclass roles][subclass role] of [required context roles][] are not automatically included as possible [required context roles][]. For example, the [`feed`](https://www.w3.org/TR/wai-aria-1.2/#feed) role is not a possible [required context role][] for [`listitem`](https://www.w3.org/TR/wai-aria-1.2/#listitem), even though [`feed`](https://www.w3.org/TR/wai-aria-1.2/#feed) is a [subclass role][] of the [`list`](https://www.w3.org/TR/wai-aria-1.2/#list) role. -Some user agents try to correct missing [required context roles][] or incorrect [content model][]. This often results, for example, in an isolated list item being presented as part of a one-item list containing only itself. Therefore, most test cases contain several targets to try and circumvent these corrections in order to better demonstrate the issue. +Some user agents try to correct missing [required context roles][] or incorrect [content model][]. This often results, for example, in an isolated list item being presented as part of a one-item list containing only itself. Therefore, most examples contain several targets to try and circumvent these corrections in order to better demonstrate the issue. ### Assumptions @@ -63,7 +63,7 @@ The rule assumes that the [explicit role][] of the applicable elements is approp - [Understanding Success Criterion 1.3.1: Info and Relationships](https://www.w3.org/WAI/WCAG22/Understanding/info-and-relationships.html) - [Required Context Role][] -## Test Cases +## Examples ### Passed @@ -80,7 +80,7 @@ These elements with an [explicit role][] of `listitem` are children in the [acce #### Passed Example 2 -These elements with an [explicit role][] of `listitem` are children in the [accessibility tree][] of an element with their [required context role][], `list`, expressed as an [implicit role][] of `ul`. Note that this test case does not satisfy [Success Criterion 4.1.1 Parsing][sc411] because the [`ul` element][ul] does not respect its [content model][]. +These elements with an [explicit role][] of `listitem` are children in the [accessibility tree][] of an element with their [required context role][], `list`, expressed as an [implicit role][] of `ul`. Note that this example does not satisfy [Success Criterion 4.1.1 Parsing][sc411] because the [`ul` element][ul] does not respect its [content model][]. ```html