From 27f5f1100cf692856fbadbfd539a5b1233303612 Mon Sep 17 00:00:00 2001 From: Sasha Nichols Date: Mon, 12 May 2025 16:00:44 -0500 Subject: [PATCH 1/9] fix aria mapping --- _rules/role-required-states-and-properties-4e8ab6.md | 1 + 1 file changed, 1 insertion(+) diff --git a/_rules/role-required-states-and-properties-4e8ab6.md b/_rules/role-required-states-and-properties-4e8ab6.md index 8d4336e1c8c..830151e3ed4 100755 --- a/_rules/role-required-states-and-properties-4e8ab6.md +++ b/_rules/role-required-states-and-properties-4e8ab6.md @@ -12,6 +12,7 @@ accessibility_requirements: passed: further testing needed inapplicable: further testing needed aria12:requiredState: # 5.2.2 Required States and Properties + title: ARIA 1.2, 5.2.2 Required States and Properties forConformance: true failed: not satisfied passed: satisfied From b3c8851b682bdf0dd04a88ebda81ce83023d0816 Mon Sep 17 00:00:00 2001 From: Sasha Nichols Date: Mon, 12 May 2025 16:04:59 -0500 Subject: [PATCH 2/9] remove comment --- _rules/role-required-states-and-properties-4e8ab6.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_rules/role-required-states-and-properties-4e8ab6.md b/_rules/role-required-states-and-properties-4e8ab6.md index 830151e3ed4..b5ed8011947 100755 --- a/_rules/role-required-states-and-properties-4e8ab6.md +++ b/_rules/role-required-states-and-properties-4e8ab6.md @@ -11,7 +11,7 @@ accessibility_requirements: failed: not satisfied passed: further testing needed inapplicable: further testing needed - aria12:requiredState: # 5.2.2 Required States and Properties + aria12:requiredState: title: ARIA 1.2, 5.2.2 Required States and Properties forConformance: true failed: not satisfied From c3e4265d2cad7f92bf241cc05f30e83914c5ddb0 Mon Sep 17 00:00:00 2001 From: Sasha Nichols Date: Mon, 12 May 2025 18:14:56 -0500 Subject: [PATCH 3/9] add test for aria properties --- __tests__/frontmatter.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/__tests__/frontmatter.js b/__tests__/frontmatter.js index 2912e9269b9..ddcefd7e952 100644 --- a/__tests__/frontmatter.js +++ b/__tests__/frontmatter.js @@ -1,7 +1,7 @@ const describeRule = require('../test-utils/describe-rule') const describePage = require('../test-utils/describe-page') -describe('frontmatter', () => { +describe.only('frontmatter', () => { /** * Rules */ @@ -90,6 +90,7 @@ function validateRuleFrontmatter({ frontmatter }, metaData) { * Check if `accessibility_requirements` (if any) has expected values */ if (accessibility_requirements) { + validateAriaProperties(accessibility_requirements) /** * The below check the `values` for every `key - value` pair of accessibility requirements */ @@ -123,3 +124,18 @@ function validateGlossaryFrontmatter({ frontmatter }) { expect(frontmatter).toHaveProperty(requiredProp) }) } + +function validateAriaProperties(accessibilityRequirements) { + const aria12Key = Object.keys(accessibilityRequirements).find(key => key.startsWith('aria12:')) + + if (aria12Key) { + // Check that aria key has an anchor name + expect(aria12Key.split(':')[1]).toBeTruthy() + + // Check that aria object has the required properties + const requiredAriaProps = ['title', 'forConformance', 'failed', 'passed'] + test.each(requiredAriaProps)('has required property `%s`', requiredProp => { + expect(accessibilityRequirements[aria12Key]).toHaveProperty(requiredProp) + }) + } +} From ffbba37eb7464dd2f0b1026e40d636d7e04937c7 Mon Sep 17 00:00:00 2001 From: Sasha Nichols Date: Mon, 12 May 2025 18:15:57 -0500 Subject: [PATCH 4/9] remove title and only --- __tests__/frontmatter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__tests__/frontmatter.js b/__tests__/frontmatter.js index ddcefd7e952..780c8cf677a 100644 --- a/__tests__/frontmatter.js +++ b/__tests__/frontmatter.js @@ -1,7 +1,7 @@ const describeRule = require('../test-utils/describe-rule') const describePage = require('../test-utils/describe-page') -describe.only('frontmatter', () => { +describe('frontmatter', () => { /** * Rules */ From d54bbbcdb3494f1ed8c36abd34da148354f2b1d8 Mon Sep 17 00:00:00 2001 From: Sasha Nichols Date: Mon, 12 May 2025 18:16:55 -0500 Subject: [PATCH 5/9] remove title and only --- _rules/role-required-states-and-properties-4e8ab6.md | 1 - 1 file changed, 1 deletion(-) diff --git a/_rules/role-required-states-and-properties-4e8ab6.md b/_rules/role-required-states-and-properties-4e8ab6.md index b5ed8011947..ef2045cdebb 100755 --- a/_rules/role-required-states-and-properties-4e8ab6.md +++ b/_rules/role-required-states-and-properties-4e8ab6.md @@ -12,7 +12,6 @@ accessibility_requirements: passed: further testing needed inapplicable: further testing needed aria12:requiredState: - title: ARIA 1.2, 5.2.2 Required States and Properties forConformance: true failed: not satisfied passed: satisfied From b941c887aa4bbf671b87b19c814a3faff12c500c Mon Sep 17 00:00:00 2001 From: Sasha Nichols Date: Mon, 12 May 2025 18:17:32 -0500 Subject: [PATCH 6/9] remove title and only --- _rules/role-required-states-and-properties-4e8ab6.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_rules/role-required-states-and-properties-4e8ab6.md b/_rules/role-required-states-and-properties-4e8ab6.md index ef2045cdebb..8d4336e1c8c 100755 --- a/_rules/role-required-states-and-properties-4e8ab6.md +++ b/_rules/role-required-states-and-properties-4e8ab6.md @@ -11,7 +11,7 @@ accessibility_requirements: failed: not satisfied passed: further testing needed inapplicable: further testing needed - aria12:requiredState: + aria12:requiredState: # 5.2.2 Required States and Properties forConformance: true failed: not satisfied passed: satisfied From 82ad99af3cc16e8591581f702126b69f9b8fd167 Mon Sep 17 00:00:00 2001 From: Sasha Nichols Date: Mon, 12 May 2025 18:24:21 -0500 Subject: [PATCH 7/9] add one more property --- __tests__/frontmatter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__tests__/frontmatter.js b/__tests__/frontmatter.js index 780c8cf677a..f182be1ee23 100644 --- a/__tests__/frontmatter.js +++ b/__tests__/frontmatter.js @@ -133,7 +133,7 @@ function validateAriaProperties(accessibilityRequirements) { expect(aria12Key.split(':')[1]).toBeTruthy() // Check that aria object has the required properties - const requiredAriaProps = ['title', 'forConformance', 'failed', 'passed'] + const requiredAriaProps = ['title', 'forConformance', 'failed', 'passed', 'inapplicable'] test.each(requiredAriaProps)('has required property `%s`', requiredProp => { expect(accessibilityRequirements[aria12Key]).toHaveProperty(requiredProp) }) From 7c67e65b1f4797470e83569b5ab0cb9175425784 Mon Sep 17 00:00:00 2001 From: Sasha Nichols Date: Thu, 29 May 2025 18:07:43 -0500 Subject: [PATCH 8/9] update test --- __tests__/frontmatter.js | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/__tests__/frontmatter.js b/__tests__/frontmatter.js index f182be1ee23..a1038b85493 100644 --- a/__tests__/frontmatter.js +++ b/__tests__/frontmatter.js @@ -1,7 +1,7 @@ const describeRule = require('../test-utils/describe-rule') const describePage = require('../test-utils/describe-page') -describe('frontmatter', () => { +describe.only('frontmatter', () => { /** * Rules */ @@ -90,22 +90,25 @@ function validateRuleFrontmatter({ frontmatter }, metaData) { * Check if `accessibility_requirements` (if any) has expected values */ if (accessibility_requirements) { - validateAriaProperties(accessibility_requirements) /** * The below check the `values` for every `key - value` pair of accessibility requirements */ - const accRequirementValues = Object.values(accessibility_requirements) - test.each(accRequirementValues)('has expected keys for accessibility requirement: `%p`', accReq => { - expect(accReq).not.toBeNull() - expect(typeof accReq).toBe('object') - const keys = Object.keys(accReq).sort() + const accessibilityReqs = Object.entries(accessibility_requirements).map(([key, value]) => ({ key, value })) + test.each(accessibilityReqs)('has expected keys for accessibility requirement: `%p`', ({ key, value }) => { + expect(value).not.toBeNull() + expect(typeof value).toBe('object') + const keys = Object.keys(value).sort() if (keys.includes('secondary')) { expect(keys.length).toBe(1) - expect(typeof accReq.secondary).toBe('string') + expect(typeof value.secondary).toBe('string') } else { + const requiredProps = ['failed', 'forConformance', 'inapplicable', 'passed'] + if (!/wcag-technique:.*/.test(key) && !/wcag2\d:.*/.test(key)) { + requiredProps.push('title') + } expect(keys.length).toBeGreaterThanOrEqual(4) - expect(keys).toIncludeAllMembers(['failed', 'forConformance', 'inapplicable', 'passed']) + expect(keys).toIncludeAllMembers(requiredProps) } }) } @@ -124,18 +127,3 @@ function validateGlossaryFrontmatter({ frontmatter }) { expect(frontmatter).toHaveProperty(requiredProp) }) } - -function validateAriaProperties(accessibilityRequirements) { - const aria12Key = Object.keys(accessibilityRequirements).find(key => key.startsWith('aria12:')) - - if (aria12Key) { - // Check that aria key has an anchor name - expect(aria12Key.split(':')[1]).toBeTruthy() - - // Check that aria object has the required properties - const requiredAriaProps = ['title', 'forConformance', 'failed', 'passed', 'inapplicable'] - test.each(requiredAriaProps)('has required property `%s`', requiredProp => { - expect(accessibilityRequirements[aria12Key]).toHaveProperty(requiredProp) - }) - } -} From 40ce6318a9c50b4fd73dae24352581ad7f207a78 Mon Sep 17 00:00:00 2001 From: Sasha Nichols Date: Thu, 29 May 2025 18:08:32 -0500 Subject: [PATCH 9/9] remove only --- __tests__/frontmatter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__tests__/frontmatter.js b/__tests__/frontmatter.js index a1038b85493..55b052699e0 100644 --- a/__tests__/frontmatter.js +++ b/__tests__/frontmatter.js @@ -1,7 +1,7 @@ const describeRule = require('../test-utils/describe-rule') const describePage = require('../test-utils/describe-page') -describe.only('frontmatter', () => { +describe('frontmatter', () => { /** * Rules */