Skip to content

Commit 6239921

Browse files
WilcoFiersJym77
andauthored
fix test on secondary requirements (act-rules#2102)
* fix test on secondary requirements * More assertions * Update _rules/aria-required-id-references-in6db8.md Co-authored-by: Jean-Yves Moyen <jym@siteimprove.com> --------- Co-authored-by: Jean-Yves Moyen <jym@siteimprove.com>
1 parent a97a8bd commit 6239921

3 files changed

Lines changed: 14 additions & 14 deletions

File tree

__tests__/frontmatter.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,17 @@ function validateRuleFrontmatter({ frontmatter }, metaData) {
9595
*/
9696
const accRequirementValues = Object.values(accessibility_requirements)
9797
test.each(accRequirementValues)('has expected keys for accessibility requirement: `%p`', accReq => {
98-
if (!accReq) {
99-
return
100-
} else if (accReq.secondary) {
101-
// Note; empty strings & false won't get here, and so aren't allowed
102-
expect(['string', 'boolean']).toContain(typeof accReq.secondary)
103-
return
104-
}
105-
98+
expect(accReq).not.toBeNull()
99+
expect(typeof accReq).toBe('object')
106100
const keys = Object.keys(accReq).sort()
107-
expect(keys.length).toBeGreaterThanOrEqual(4)
108-
expect(keys).toIncludeAllMembers(['failed', 'forConformance', 'inapplicable', 'passed'])
101+
102+
if (keys.includes('secondary')) {
103+
expect(keys.length).toBe(1)
104+
expect(typeof accReq.secondary).toBe('string')
105+
} else {
106+
expect(keys.length).toBeGreaterThanOrEqual(4)
107+
expect(keys).toIncludeAllMembers(['failed', 'forConformance', 'inapplicable', 'passed'])
108+
}
109109
})
110110
}
111111
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ accessibility_requirements:
1212
passed: satisfied
1313
inapplicable: satisfied
1414
wcag20:1.3.1: # Info and Relationships (A)
15-
secondary: true
15+
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.
1616
wcag20:4.1.2: # Name, Role, Value (A)
17-
secondary: true
17+
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.
1818
input_aspects:
1919
- DOM Tree
2020
- CSS Styling
@@ -32,7 +32,7 @@ This rule applies to any `aria-controls` attribute defined on an [HTML element][
3232

3333
## Expectation
3434

35-
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]
35+
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].
3636

3737
## Assumptions
3838

_rules/text-contrast-afw4f7.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ accessibility_requirements:
1111
passed: further testing needed
1212
inapplicable: further testing needed
1313
wcag20:1.4.6: # Contrast (Enhanced) (AAA)
14-
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.
14+
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.
1515
input_aspects:
1616
- Accessibility Tree
1717
- DOM Tree

0 commit comments

Comments
 (0)