From 6239921ae7c376da619f7a581bffd1a263158d6b Mon Sep 17 00:00:00 2001 From: Wilco Fiers Date: Wed, 30 Aug 2023 13:24:45 +0200 Subject: [PATCH] fix test on secondary requirements (#2102) * fix test on secondary requirements * More assertions * Update _rules/aria-required-id-references-in6db8.md Co-authored-by: Jean-Yves Moyen --------- Co-authored-by: Jean-Yves Moyen --- __tests__/frontmatter.js | 20 ++++++++++---------- _rules/aria-required-id-references-in6db8.md | 6 +++--- _rules/text-contrast-afw4f7.md | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/__tests__/frontmatter.js b/__tests__/frontmatter.js index d7c13bb965..2912e9269b 100644 --- a/__tests__/frontmatter.js +++ b/__tests__/frontmatter.js @@ -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']) + } }) } } diff --git a/_rules/aria-required-id-references-in6db8.md b/_rules/aria-required-id-references-in6db8.md index 6904de0f38..d90010083c 100644 --- a/_rules/aria-required-id-references-in6db8.md +++ b/_rules/aria-required-id-references-in6db8.md @@ -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 @@ -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 diff --git a/_rules/text-contrast-afw4f7.md b/_rules/text-contrast-afw4f7.md index aec1553c88..b6edb3d368 100755 --- a/_rules/text-contrast-afw4f7.md +++ b/_rules/text-contrast-afw4f7.md @@ -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