Skip to content

Commit

Permalink
fix test on secondary requirements (#2102)
Browse files Browse the repository at this point in the history
* fix test on secondary requirements

* More assertions

* Update _rules/aria-required-id-references-in6db8.md

Co-authored-by: Jean-Yves Moyen <[email protected]>

---------

Co-authored-by: Jean-Yves Moyen <[email protected]>
  • Loading branch information
WilcoFiers and Jym77 committed Oct 13, 2023
1 parent 4f72c9f commit 2432d54
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
20 changes: 10 additions & 10 deletions __tests__/frontmatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,17 @@ function validateRuleFrontmatter({ frontmatter }, metaData) {
*/
const accRequirementValues = Object.values(accessibility_requirements)
test.each(accRequirementValues)('has expected keys for accessibility requirement: `%p`', accReq => {
if (!accReq) {
return
} else if (accReq.secondary) {
// Note; empty strings & false won't get here, and so aren't allowed
expect(['string', 'boolean']).toContain(typeof accReq.secondary)
return
}

expect(accReq).not.toBeNull()
expect(typeof accReq).toBe('object')
const keys = Object.keys(accReq).sort()
expect(keys.length).toBeGreaterThanOrEqual(4)
expect(keys).toIncludeAllMembers(['failed', 'forConformance', 'inapplicable', 'passed'])

if (keys.includes('secondary')) {
expect(keys.length).toBe(1)
expect(typeof accReq.secondary).toBe('string')
} else {
expect(keys.length).toBeGreaterThanOrEqual(4)
expect(keys).toIncludeAllMembers(['failed', 'forConformance', 'inapplicable', 'passed'])
}
})
}
}
Expand Down
6 changes: 3 additions & 3 deletions _rules/aria-required-id-references-in6db8.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ accessibility_requirements:
passed: satisfied
inapplicable: satisfied
wcag20:1.3.1: # Info and Relationships (A)
secondary: true
secondary: This success criterion is **less strict** than this rule. This is because the rule does not check for alternatives which may be accessible. Some of the failed examples satisfy this success criterion.
wcag20:4.1.2: # Name, Role, Value (A)
secondary: true
secondary: This success criterion is **less strict** than this rule. This is because the rule does not check for alternatives which may be accessible. Some of the failed examples satisfy this success criterion.
input_aspects:
- DOM Tree
- CSS Styling
Expand All @@ -32,7 +32,7 @@ This rule applies to any `aria-controls` attribute defined on an [HTML element][

## Expectation

Each test target's [attribute value][] is a space-separated list of one or more IDs. At least one of those IDs must match an `id` [attribute value][] in the same [shadow tree][] or, if not within a [shadow tree][], within the same [document][document tree]
Each test target's [attribute value][] is a space-separated list of one or more IDs. At least one of those IDs must match an `id` [attribute value][] in the same [shadow tree][] or, if not within a [shadow tree][], within the same [document][document tree].

## Assumptions

Expand Down
2 changes: 1 addition & 1 deletion _rules/text-contrast-afw4f7.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ accessibility_requirements:
passed: further testing needed
inapplicable: further testing needed
wcag20:1.4.6: # Contrast (Enhanced) (AAA)
secondary: This success criterion is **more strict** than this rule. This is because this criterion has a higher minimum contrast. Some of the passed examples do not satisfy this success criterion.
secondary: This success criterion is **more strict** than this rule. This is because this criterion has a higher minimum contrast. Some of the passed examples do not satisfy this success criterion.
input_aspects:
- Accessibility Tree
- DOM Tree
Expand Down

0 comments on commit 2432d54

Please sign in to comment.